0.0
No commit activity in last 3 years
No release in over 3 years
A code snippet handling tool
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.6
~> 11.0
~> 0.11
~> 13.0
>= 3.7.0, ~> 3.7
~> 0.58
>= 3.4.0, ~> 3.4
~> 0.16
~> 0.9

Runtime

 Project Readme

CodeSnippet

Ruby

A code snippet handling tool that makes it easy to quickly access chunks of code.

Installation

Install the gem into your system:

gem install code_snippet

Usage

Before you begin

Before you use snippet, you need to set the SNIPPET_DIR environment variable to a path that contains your snippets:

export SNIPPET_DIR="/Users/me/Code/snippets"

Creating snippets

Snippets are just text files with the extension of the target language. For example, for_i.go might ontain a for loop.

The code does not need to compile or be able to be interpreted for it to be displayed by snippet, it should be content that's easy to paste into the project you're currently working on.

Listing and Viewing Snippets

Once you have a set of snippets, run snippet list to show a list of all your snippets:

$ snippet list

NAME                          LANG
for_i                         .go 
table_test                    .go

You can then show a snippet by executing snippet show <name>:

$ snippet show for_i

for 1 := 1; i < 10; i++ {
  // do something
}

You can copy the snippet straight to the clipboard by adding the --copy to the end of the command.

Tests and Quality

Tests cover this project and are written in RSpec. You'll find them in the spec folder.

bundle exec rspec spec

Tests and quality tasks are included in the default rake task which can be run thus:

bundle exec rake

Contributing

See CONTRIBUTING.md for more information

Licence

This gem is covered by the terms of the MIT licence. See LICENCE for more information