snipcli 0.3.1

Snipline CLI is the command-line tool for Snipline

Releases:

  • 0.3.1 - January 14, 2020
  • 0.3.0 - January 10, 2020
  • 0.2.0 - September 2, 2019
  • 0.1.5 - July 10, 2019
  • 0.1.4 - June 4, 2019

Owner:

Snipline CLI

Snipline CLI allows you to organise and use your favourite shell commands from the terminal. It can optionally sync to your Snipline account.

SnipCLI Preview

Installation

Homebrew (MacOS)

Snipline CLI is available through Homebrew for MacOS and Linux.

brew install snipline/snipline/snipcli

Snapcraft (Linux)

Linux users can download via Snapcraft

sudo snap install snipcli --beta

From source

Snipline CLI requires Crystal 0.30.1 to be installed to install from source

# Clone the repo
git clone git@github.com:snipline/snipcli.git
# Checkout the latest release
git checkout <tagname - e.g. 0.3.1>
# Make sure you have the same Crystal installed that's required in shard.yml
crystal -v
# Install dependencies
shards
# Build app
crystal build src/snipline_cli.cr -o snipcli --release -o snipcli
./snipcli --version

Upgrading

Upgrading Snipline CLI depends on your method of installation

# Homebrew
brew upgrade snipline/snipline/snipcli

# Snapcraft
snap refresh

# From Source
git pull origin master
git checkout <tagname - e.g. 0.3.1>
crystal -v # confirm Crystal is the same as shard.yml requirement
shards
crystal build src/snipline_cli.cr -o snipcli --release -o snipcli
./snipcli --version

Usage

Using Snipline CLI for free

Snipline CLI can be used without an active Snipline account.

To generate the initial configuration files use the init command.

snipcli init

The above command will generate a config.toml file and a snippets.json file in your ~/.config/snipline directory.

Syncing to Snipline

Log-in to your Snipline account and sync your snippets.

Follow login instructions (Enter email and token)

snipcli login

Download snippets from your Snipline account

snipcli sync

Searching snippets

A basic search can be done with the search command.

snipcli search

If you wish to pre-filter the results you can do so by adding a search term and specify the field to search on.

snipcli search <searchterm> --field=tags

Search options include field and limit. See snipcli search --help for more information

Note that as of 0.2.0 it's not possible to search and copy to clipboard from a Linux VM/SSH session. Use run to run the command directly from your terminal session.

Creating a new snippet

You can create a new snippet by using the new command. This will open a TOML file in the text editor of your preference. Once closed it will attempt to add it to your snippets.json file and sync to your Snipline Account.

snipcli new

Web interface

As of 0.3.0 the web interface has been removed infavour of the new TUI.

Development

See the Installation section on building from source.

Set log levels for additional development output.

crystal build src/snipline_cli.cr -o snipcli
env LOG_LEVEL=DEBUG ./snipcli search git

To change the config file location (For testing) use the CONFIG_FILE environment variable.

There is an example already in place for testing located in config.spec.toml

env CONFIG_FILE=./config.spec.toml crystal spec

Contributing

See the Contributing guide for details.

TODO

  • More tests.
  • More documentation (Including usage without a Snipline account).
  • Syncing local snippets via snipcli sync.
  • Editing snippets.
  • Compact search mode.

Contributors

Changelog

0.3.1

Changes

  • Update temp snippet TOML file to include instructions for escaping quotes in commands and documentation

Bugfixes

  • Escape quotes in commands, documentation, and snippet name when editing a snippet
  • Remove debug output after saving an edited snippet
  • Always create a new temp snippet file even when it exists to prevent editing the wrong snippet

0.3.0

Features

  • Upgraded Crystal to 0.31.1
  • Overhauled the search command
    • New NCurses TUI
    • Fuzzy match searching.
    • Deleting snippets via search.
    • Editing snippets via search.
    • Copy/run snippets via search
  • Ability to edit and delete commands through the search interface.
  • Moved from JSON storage to Sqlite - including a built in migration process
  • Syncing snippets improvements:
    • New local-only snippets will sync back to Snipline Cloud.
    • Snipline Cloud snippets will now delete locally on sync.
    • Locally edited snippets will sync back to Snipline Cloud.
    • New --dry-run flag to see what will change during sync.
    • New --verbose flag to see what has changed during sync.

Changes

  • Refactoring and testing to various classes.
  • Snippets are now stored in an Sqlite database rather than JSON file.
  • sync command now migrates the Sqlite database.
  • Added Crecto for managing snippets from Sqlite.

Bugfixes

None

0.2.0

Features

  • Added new command to create new snippets from command line.
  • new --run flag for search command to run the selected snippet
  • Added ability to create snippets from the web interface.

Changes

  • search command now copies the selected snippet instead of running.
  • Updated Crystal to 0.30.1
  • Updated lodash dependency for web interface.
  • Removed web command.

Bugfixes

None!

Github statistic:
  • 9
  • 0
  • 0
  • 0
  • 0
  • 1 day ago

License:

MIT License

Links: