Skip to content

Commit

Permalink
Merge pull request #55 from DannyBen/update/texts
Browse files Browse the repository at this point in the history
Update usage texts and man pages
  • Loading branch information
DannyBen committed Aug 28, 2023
2 parents df94c5f + b73e979 commit 5e80cf1
Show file tree
Hide file tree
Showing 38 changed files with 404 additions and 240 deletions.
112 changes: 76 additions & 36 deletions alf
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ alf_usage() {
echo
# :command.usage_commands
printf "%s\n" "$(bold "Commands:")"
printf " %s Connect to a remote git repository\n" "$(green "connect") "
printf " %s Perform git pull on the connected repo\n" "$(green "download")"
printf " %s Perform git commit and push on the connected repo\n" "$(green "upload") "
printf " %s Generate aliases to stdout\n" "$(green "generate")"
printf " %s Generate aliases to ~/.bash_aliases\n" "$(green "save") "
printf " %s Open your alf.conf for editing\n" "$(green "edit") "
printf " %s Show the alias command\n" "$(green "which") "
printf " %s Upgrade alf to the latest version\n" "$(green "upgrade") "
printf " %s Show all alf related system facts\n" "$(green "info") "
printf " %s Connect to a remote git repository.\n" "$(green "connect") "
printf " %s Perform git pull on the connected repo.\n" "$(green "download")"
printf " %s Perform git commit and push on the connected repo.\n" "$(green "upload") "
printf " %s Generate aliases to stdout.\n" "$(green "generate")"
printf " %s Generate aliases to \`~/.bash_aliases\`.\n" "$(green "save") "
printf " %s Open your \`alf.conf\` for editing.\n" "$(green "edit") "
printf " %s Show the alias command.\n" "$(green "which") "
printf " %s Upgrade alf to the latest version.\n" "$(green "upgrade") "
printf " %s Show all alf related system facts.\n" "$(green "info") "
echo

# :command.long_usage
Expand All @@ -62,7 +62,7 @@ alf_usage() {

# :environment_variable.usage
printf " %s\n" "ALF_RC_FILE"
printf " Path to alfrc file\n This file holds the path to the alf-conf repository\n Default: ~/.alfrc\n"
printf " Path to alfrc file.\n \n This file holds the path to the alf-conf repository.\n \n Default: \`~/.alfrc\`\n"
echo

fi
Expand All @@ -71,11 +71,11 @@ alf_usage() {
# :command.usage
alf_connect_usage() {
if [[ -n $long_usage ]]; then
printf "alf connect - Connect to a remote git repository\n"
printf "alf connect - Connect to a remote git repository.\n"
echo

else
printf "alf connect - Connect to a remote git repository\n"
printf "alf connect - Connect to a remote git repository.\n"
echo

fi
Expand All @@ -95,17 +95,17 @@ alf_connect_usage() {
# :command.usage_flags
# :flag.usage
printf " %s\n" "--ssh"
printf " Connect to GitHub non-interactively using SSH (implies --yes)\n"
printf " Connect to GitHub non-interactively using SSH (implies \`--yes\`).\n"
echo

# :flag.usage
printf " %s\n" "--https"
printf " Connect to GitHub non-interactively using HTTPS (implies --yes)\n"
printf " Connect to GitHub non-interactively using HTTPS (implies \`--yes\`).\n"
echo

# :flag.usage
printf " %s\n" "--yes, -y"
printf " Connect to any remote repository non-interactively\n"
printf " Connect to any remote repository non-interactively.\n"
echo

# :command.usage_fixed_flags
Expand All @@ -118,7 +118,7 @@ alf_connect_usage() {

# :argument.usage
printf " %s\n" "REPO"
printf " Remote GitHub repository to connect to. This can be one of:\n \n - Your username on GitHub. In this case, the repository is expected to\n be named 'alf-conf'\n - Your username/repo on GitHub\n - Any other full URL to a repository\n"
printf " Remote GitHub repository to connect to.\n \n Can be one of:\n \n - Your username on GitHub.\n In this case, the repository is expected to be named \`alf-conf\`.\n - Your username/repo on GitHub.\n - Any other full URL to a repository.\n"
echo

# :command.usage_examples
Expand All @@ -134,11 +134,11 @@ alf_connect_usage() {
# :command.usage
alf_download_usage() {
if [[ -n $long_usage ]]; then
printf "alf download - Perform git pull on the connected repo\n"
printf "alf download - Perform git pull on the connected repo.\n"
echo

else
printf "alf download - Perform git pull on the connected repo\n"
printf "alf download - Perform git pull on the connected repo.\n"
echo

fi
Expand Down Expand Up @@ -166,11 +166,11 @@ alf_download_usage() {
# :command.usage
alf_upload_usage() {
if [[ -n $long_usage ]]; then
printf "alf upload - Perform git commit and push on the connected repo\n"
printf "alf upload - Perform git commit and push on the connected repo.\n"
echo

else
printf "alf upload - Perform git commit and push on the connected repo\n"
printf "alf upload - Perform git commit and push on the connected repo.\n"
echo

fi
Expand Down Expand Up @@ -198,11 +198,11 @@ alf_upload_usage() {
# :command.usage
alf_generate_usage() {
if [[ -n $long_usage ]]; then
printf "alf generate - Generate aliases to stdout\n"
printf "alf generate - Generate aliases to stdout.\n"
echo

else
printf "alf generate - Generate aliases to stdout\n"
printf "alf generate - Generate aliases to stdout.\n"
echo

fi
Expand Down Expand Up @@ -230,11 +230,11 @@ alf_generate_usage() {
# :command.usage
alf_save_usage() {
if [[ -n $long_usage ]]; then
printf "alf save - Generate aliases to ~/.bash_aliases\n"
printf "alf save - Generate aliases to \`~/.bash_aliases\`.\n"
echo

else
printf "alf save - Generate aliases to ~/.bash_aliases\n"
printf "alf save - Generate aliases to \`~/.bash_aliases\`.\n"
echo

fi
Expand All @@ -261,7 +261,7 @@ alf_save_usage() {

# :environment_variable.usage
printf " %s\n" "ALF_ALIASES_FILE"
printf " Path to bash_aliases file\n Aliases will be saved to this file\n Default: ~/.bash_aliases\n"
printf " Path to bash_aliases file.\n \n Aliases will be saved to this file.\n \n Default: \`~/.bash_aliases\`\n"
echo

fi
Expand All @@ -270,11 +270,11 @@ alf_save_usage() {
# :command.usage
alf_edit_usage() {
if [[ -n $long_usage ]]; then
printf "alf edit - Open your alf.conf for editing\n"
printf "alf edit - Open your \`alf.conf\` for editing.\n"
echo

else
printf "alf edit - Open your alf.conf for editing\n"
printf "alf edit - Open your \`alf.conf\` for editing.\n"
echo

fi
Expand Down Expand Up @@ -302,11 +302,11 @@ alf_edit_usage() {
# :command.usage
alf_which_usage() {
if [[ -n $long_usage ]]; then
printf "alf which - Show the alias command\n"
printf "alf which - Show the alias command.\n"
echo

else
printf "alf which - Show the alias command\n"
printf "alf which - Show the alias command.\n"
echo

fi
Expand All @@ -333,12 +333,12 @@ alf_which_usage() {

# :argument.usage
printf " %s\n" "CODE"
printf " Show the command for this alias code\n"
printf " Show the command for this alias code.\n"
echo

# :argument.usage
printf " %s\n" "SUBCODE"
printf " Show the command for this alias sub-code\n"
printf " Show the command for this alias sub-code.\n"
echo

fi
Expand All @@ -347,11 +347,11 @@ alf_which_usage() {
# :command.usage
alf_upgrade_usage() {
if [[ -n $long_usage ]]; then
printf "alf upgrade - Upgrade alf to the latest version\n"
printf "alf upgrade - Upgrade alf to the latest version.\n"
echo

else
printf "alf upgrade - Upgrade alf to the latest version\n"
printf "alf upgrade - Upgrade alf to the latest version.\n"
echo

fi
Expand All @@ -376,11 +376,11 @@ alf_upgrade_usage() {
# :command.usage
alf_info_usage() {
if [[ -n $long_usage ]]; then
printf "alf info - Show all alf related system facts\n"
printf "alf info - Show all alf related system facts.\n"
echo

else
printf "alf info - Show all alf related system facts\n"
printf "alf info - Show all alf related system facts.\n"
echo

fi
Expand Down Expand Up @@ -1049,6 +1049,14 @@ alf_connect_parse_requirements() {
esac
done

# :command.dependencies_filter
if command -v git >/dev/null 2>&1; then
deps['git']="$(command -v git | head -n1)"
else
printf "missing dependency: git\n" >&2
exit 1
fi

# :command.command_filter
action="connect"

Expand Down Expand Up @@ -1128,6 +1136,14 @@ alf_download_parse_requirements() {
esac
done

# :command.dependencies_filter
if command -v git >/dev/null 2>&1; then
deps['git']="$(command -v git | head -n1)"
else
printf "missing dependency: git\n" >&2
exit 1
fi

# :command.command_filter
action="download"

Expand Down Expand Up @@ -1172,6 +1188,14 @@ alf_upload_parse_requirements() {
esac
done

# :command.dependencies_filter
if command -v git >/dev/null 2>&1; then
deps['git']="$(command -v git | head -n1)"
else
printf "missing dependency: git\n" >&2
exit 1
fi

# :command.command_filter
action="upload"

Expand Down Expand Up @@ -1408,6 +1432,14 @@ alf_upgrade_parse_requirements() {
esac
done

# :command.dependencies_filter
if command -v curl >/dev/null 2>&1; then
deps['curl']="$(command -v curl | head -n1)"
else
printf "missing dependency: curl\n" >&2
exit 1
fi

# :command.command_filter
action="upgrade"

Expand Down Expand Up @@ -1452,6 +1484,14 @@ alf_info_parse_requirements() {
esac
done

# :command.dependencies_filter
if command -v git >/dev/null 2>&1; then
deps['git']="$(command -v git | head -n1)"
else
printf "missing dependency: git\n" >&2
exit 1
fi

# :command.command_filter
action="info"

Expand Down Expand Up @@ -1480,7 +1520,7 @@ alf_info_parse_requirements() {

# :command.initialize
initialize() {
version="0.5.1"
version="0.6.0"
long_usage=''
set -e

Expand Down
77 changes: 41 additions & 36 deletions doc/alf-connect.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,58 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "alf" "1" "August 2023" "Version 0.5.1" "Your Little Bash Alias Friend"
.TH "alf-connect" "1" "August 2023" "" "Connect to a remote git repository."
.hy
.SH NAME
.PP
\f[B]alf\f[R] - Your Little Bash Alias Friend
\f[B]alf connect\f[R] - Connect to a remote git repository.
.SH SYNOPSIS
.PP
\f[B]alf\f[R] COMMAND
\f[B]alf connect\f[R] REPO OPTIONS
.SH DESCRIPTION
.PP
Your Little Bash Alias Friend
.SH COMMANDS
.SS alf connect
Connect to a remote git repository.
.IP \[bu] 2
Alias: \f[B]c\f[R]
.SH ARGUMENTS
.SS REPO
.PP
Connect to a remote git repository
.SS alf download
Remote GitHub repository to connect to.
.PP
Perform git pull on the connected repo
.SS alf upload
Can be one of:
.IP \[bu] 2
Your username on GitHub.
In this case, the repository is expected to be named \f[B]alf-conf\f[R].
.IP \[bu] 2
Your username/repo on GitHub.
.IP \[bu] 2
Any other full URL to a repository.
.IP \[bu] 2
\f[I]Required\f[R]
.SH OPTIONS
.SS --ssh
.PP
Perform git commit and push on the connected repo
.SS alf generate
Connect to GitHub non-interactively using SSH (implies \f[B]--yes\f[R]).
.SS --https
.PP
Generate aliases to stdout
.SS alf save
Connect to GitHub non-interactively using HTTPS (implies
\f[B]--yes\f[R]).
.SS --yes, -y
.PP
Generate aliases to \[ti]/.bash_aliases
.SS alf edit
.PP
Open your alf.conf for editing
.SS alf which
.PP
Show the alias command
.SS alf upgrade
.PP
Upgrade alf to the latest version
.SS alf info
.PP
Show all alf related system facts
.SH ENVIRONMENT VARIABLES
.SS ALF_RC_FILE
.PP
Path to alfrc file This file holds the path to the alf-conf repository
Default: \[ti]/.alfrc
Connect to any remote repository non-interactively.
.SH DEPENDENCIES
.SS git
.SH EXAMPLES
.IP
.nf
\f[C]
alf connect you --ssh

alf connect you/alf-config

alf connect https://You\[at]bitbucket.org/YourUser/rush-repo.git --yes
\f[R]
.fi
.SH SEE ALSO
.PP
\f[B]alf-connect\f[R](1), \f[B]alf-download\f[R](1),
\f[B]alf-upload\f[R](1), \f[B]alf-generate\f[R](1),
\f[B]alf-save\f[R](1), \f[B]alf-edit\f[R](1), \f[B]alf-which\f[R](1),
\f[B]alf-upgrade\f[R](1), \f[B]alf-info\f[R](1)
\f[B]alf\f[R](1)
Loading

0 comments on commit 5e80cf1

Please sign in to comment.