Open NobbZ opened 1 month ago
You can already pass --name
. You do npins add --name foobar github someone reponame
from the README:
$ npins help add
npins-add 0.2.4
Adds a new pin entry
USAGE:
npins add [FLAGS] [OPTIONS] <SUBCOMMAND>
FLAGS:
-n, --dry-run Don't actually apply the changes
-h, --help Prints help information
OPTIONS:
-d, --directory <folder> Base folder for sources.json and the boilerplate default.nix [env: NPINS_DIRECTORY=]
[default: npins]
--name <name> Custom name for the pin entry
SUBCOMMANDS:
channel Track a Nix channel
git Track a git repository
github Track a GitHub repository
gitlab Track a GitLab repository
help Prints this message or the help of the given subcommand(s)
pypi Track a package on PyPi
Oh, its not listed when doing npins add github --help
, maybe the help could inherit parents switches?
Funny that --directory
is displayed though.
It doesn't even work, unless use between add
and github
, this is a bit annoying. It should be position indipendant.
$ npins add github Feel-ix-343 markdown-oxide -b main --name nvim-oxide
error: Found argument '--name' which wasn't expected, or isn't valid in this context
USAGE:
npins add github <owner> <repository> --branch <branch>
For more information try --help
$ npins add --name nvim-oxide github Feel-ix-343 markdown-oxide -b main
[INFO ] Adding 'nvim-oxide' …
repository: https://github.com/Feel-ix-343/markdown-oxide.git
branch: main
revision: bd44db39f55b26a93aa56eb18eb105488a6a972d
url: https://github.com/Feel-ix-343/markdown-oxide/archive/bd44db39f55b26a93aa56eb18eb105488a6a972d.tar.gz
hash: 06h6s83g1rfvdxzgndi6krs787mvdal7am4pp1y07wz316bz7sdr
I am not sure that is currently possible with the structopt
library we are using. Probably a good change if you find documentation on that.
Have you considered using an actively developed library, like claps?
The structopt
developers suggest it by themselves, as it offers same functionality:
Last time I tried to migrate the derive based API was missing some feature that we are using. I've not tried since. If you dare to try please go ahead. Happy to migrate but I can't dedicate that amount of time right now.
I don't think this is possible within the framework of clap, and structopt is just a proc macro frontend for that. You can mark flags as global, but there is no way to make them only propagate down in one direction
sometimes I want to add repos with complicated names and have them simpler in the repo, sometimes I use prefix strings to filter and autogenerate drvs.
For those situations it would be nice if it was possible to provide a
--name
flag when adding.Currently I work around that missing flag by manually editing the
sources.json
.