list remotes if no argument is provided
This commit is contained in:
parent
cbf64a2e14
commit
6181b417f3
1 changed files with 8 additions and 4 deletions
12
gra
12
gra
|
|
@ -10,7 +10,7 @@ function print_usage {
|
||||||
Usage: gra [OPTIONS] REMOTE_NAME
|
Usage: gra [OPTIONS] REMOTE_NAME
|
||||||
|
|
||||||
Add a Git remote by providing a single name. Shorthands can be defined in
|
Add a Git remote by providing a single name. Shorthands can be defined in
|
||||||
~/.config/gra.config.
|
~/.config/gra.config. If no REMOTE_NAME is provided, all remotes get listed.
|
||||||
|
|
||||||
REMOTE_NAME Name of the remote
|
REMOTE_NAME Name of the remote
|
||||||
|
|
||||||
|
|
@ -47,14 +47,18 @@ while (( "$#" )); do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check missing argument
|
|
||||||
[ "$remote_name" == "" ] && print_usage && exit 0
|
|
||||||
|
|
||||||
# TODO: Check if in Git repository
|
# TODO: Check if in Git repository
|
||||||
if ! git status &> /dev/null; then
|
if ! git status &> /dev/null; then
|
||||||
error "Not inside a Git repository"
|
error "Not inside a Git repository"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Show remotes if no remote name was passed
|
||||||
|
if [ "$remote_name" == "" ]; then
|
||||||
|
echo -e "Argument ${text_bold}REMOTE_NAME${text_reset} not provided, listing remotes\n"
|
||||||
|
git remote -v
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Read config
|
# Read config
|
||||||
[ -f ~/.config/gra.config ] && source ~/.config/gra.config
|
[ -f ~/.config/gra.config ] && source ~/.config/gra.config
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue