Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce add subcommand per fetcher type #35

Closed
wants to merge 5 commits into from
Closed

Conversation

nlewo
Copy link
Collaborator

@nlewo nlewo commented Mar 23, 2019

This commit introduces subcommand to the add command. These
subcommands permit to specify a fetcher type in order to be able to
specify options per fetcher type. For instance, the --branch option is
useless for the file fetcher. Thanks to this commit, the --branch
option is only displayed in the help of the niv add github command.

Some usage examples:

niv add github stedolan/jq
niv add github NixOS/nixpkgs-channels -n nixpkgs -b nixos-18.09

niv add file my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip

TODO:

  • Update readme

@nlewo nlewo requested a review from nmattia March 23, 2019 11:30
@nmattia
Copy link
Owner

nmattia commented Mar 24, 2019

Nice, thanks! Why not have a flag instead? e.g.

$ niv add --github ...
$ niv add --docker ...

I understand that in that case the help message may become a bit long but at least you can still write

$ niv add nmattia/niv

which I think is invaluable. Or maybe we can have an optional subcommand? is that possible with optparse?

@nlewo
Copy link
Collaborator Author

nlewo commented Mar 25, 2019

I dont' think we could have a nice help menu with flags since they are not really suitable to group arguments.

What about trying to create a special add subcommand that could be used as a shortcut:

$ niv add github ...
$ niv add nmattia/niv ...

However, I don't know if it is possible with the lib :/

@nmattia
Copy link
Owner

nmattia commented Mar 25, 2019

I gave this a try, I think there are a few solutions: bdd3e98

Let's pair and see what we can come up with!

@nlewo nlewo changed the title Introduce add subcommand per fetcher type WIP: Introduce add subcommand per fetcher type Mar 27, 2019
@nlewo nlewo force-pushed the subcommand branch 5 times, most recently from 25fc4c9 to 98ba9e7 Compare April 15, 2019 13:58
@nlewo nlewo changed the title WIP: Introduce add subcommand per fetcher type Introduce add subcommand per fetcher type Apr 15, 2019
nlewo added 3 commits April 15, 2019 18:06
This commit introduces subcommand to the `add` command. These
subcommands permit to specify a fetcher type in order to be able to
specify options per fetcher type. For instance, the `--branch` option is
useless for the `file` fetcher. Thanks to this commit, the `--branch`
option is only displayed in the help of the `niv add github` command.

Some usage examples:

    niv add github stedolan/jq
    niv add github NixOS/nixpkgs-channels -n nixpkgs -b nixos-18.09

    niv add file my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip
nlewo added 2 commits April 16, 2019 13:44
This commit also improves parsing of several options: `type`,
`url-template` options can no longer be repeated.
@nmattia
Copy link
Owner

nmattia commented Dec 7, 2019

Closing, handled in #151

@nmattia nmattia closed this Dec 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants