Snippet v0.3 released
When using my snippet tool in practise, I noticed the CLI didn’t behave as most other tools. This was mainly due to the Golang flag package. Although I’m not sure why, it seems to abide by no other standard out there and as a user I dread using Go packages that use the Go flag package.
This meant that another package was needed, in case you like the details, the stable v1 branch of urfave/cli is used. It handled most of the cases the snippet package needed. Although this opportunity was used to improve the flag naming a bit.
Synopsis Link to heading
NAME:
snippet - A new cli application
USAGE:
snippet [global options] command [command options] [arguments...]
VERSION:
0.3.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--file value, -f value Create a snippet from file on disk instead of piped input
--permission value, -p value Set visibility of the snippet, one of: public, internal, or private (default: "public")
--token value, -t value Token if not using the $HOME/.gitlab-token file [$GITLAB_TOKEN]
--help, -h show help
--version, -v print the version
Note: the usage text, right after NAME: snippet
is updated in the latest commit
on master. I didn’t think the hassle of a new release was worth releasing v0.3.1.
The other use case that’s not mentioned in the output, is that when a --file
value is missing, the program expects output from STDIN so output can be piped
into it. This is convenient in a chain of shell commands. And the output is still
the same, the URL to the Snippet.
A small addition is support for $GITLAB_TOKEN to hold your token in an environment variable. Which allows you to set the value in another way some users prefer.
Installing Snippet Link to heading
Installing Snippet can be done in a few ways. The easiest for a Go developer is
go install gitlab.com/zj/snippet
. But since this release the Snippet binary
has been compiled on CI for both Darwin and Linux. These can be downloaded from
the releases page. For the SHA256 sums
I’ll defer to the CI job trace.
Contributing Link to heading
Contributions are greatly appreciated, both feature ideas and bug reports as
issues or code as
merge request. Feel free to ping
@zj
when you need help!