git.fiddlerwoaroof.com
Raw Blame History
#compdef nix-channel
#autoload

_nix-common-options

# TODO: Handle case where nix-channel --list is empty
_nix_channels() {
  _values 'Nix Channels' $(nix-channel --list | awk '{ print $1 }' ORS=' ')
}

_arguments \
  '(- *)--add[Subscribe to a channel]:Channel URL:_urls::Channel Name:( )'\
  '(- *)--remove[Unsubscribe from a channel]:Channel Name:_nix_channels'\
  '(- *)--list[List subscribed channels]'\
  '(- *)--update[Update and activate channels]:Channel Name:_nix_channels'\
  '(- *)--rollback[Revert the previous nix-channel --update]'