Skip to content

Instantly share code, notes, and snippets.

@kemelzaidan
Last active October 10, 2023 19:56
Show Gist options
  • Save kemelzaidan/918f3cbea32f3dbf1b5ff719e301f44f to your computer and use it in GitHub Desktop.
Save kemelzaidan/918f3cbea32f3dbf1b5ff719e301f44f to your computer and use it in GitHub Desktop.
a wrapper around SSH AUR commands
function saur -d "a wrapper around SSH AUR commands"
set -g AUR "[email protected]"
set KEYS ~/.ssh/*pub ~/.ssh/*pem
if test (count $KEYS) -eq 0
echo "Create you SSH key and upload the public one to AUR"
return 1
end
if test (count $argv) -eq 1
switch $argv
case --help -h help
print_help
case -l list
ssh $AUR list-repos
end
else if test (count $argv) -eq 2
switch $argv[1]
case -v vote
ssh $AUR vote $argv[2]
case -r remove-vote
ssh $AUR unvote $argv[2]
case -a adopt
ssh $AUR adopt $argv[2]
case -f flag
ssh $AUR flag $argv[2..-1]
case -u unflag
ssh $AUR unflag $argv[2]
case -d disown
ssh $AUR disown $argv[2]
case -k keywords
ssh set-keywords $argv[2..-1]
case -m maintainers
ssh set-comaintainers $arg[2..-1]
end
else
print_help
end
# helper function
function print_help
echo "
\$ saur <action> <package> OPTIONAL_ARGUMENTS
Commands:
-a adopt <package> Adopt a package.
-d disown <package> Disown a package base.
-f flag <package> <comment> Flag a package base out-of-date.
-h help Show this help message and exit.
-l list List all your adopted packages.
-m maintainers <package> [...] Set package co-maintainers.
-k keywords <package> [...] Change package keywords.
-u unflag <package> Remove out-of-date flag from a package.
-r remove-vote <package> Remove vote from a package.
-v vote <package> Vote for a package.
"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment