diff --git a/dotmg b/dotmg index 9aecc10..f8593fd 100644 --- a/dotmg +++ b/dotmg @@ -117,11 +117,26 @@ dotmg-dont-ignore() { done } +dotmg-help() { + printf "Usage: dotmg command [argument]...\n\n" + printf "Commands\n\n" + printf "\tadd\tAdd the specified file or directory argument(s) to not be ignored by git\n" + printf "\tclean-newlines\tRemoves any empty newlines that are present in the .gitignore file in the current directory\n" + printf "\thelp\tDisplay help\n" + printf "\tinit\tInitialises a git repository in \$HOUSE and writes a base .gitignore in that directory\n" + printf "\tinit-gitignore\tWrites only a base .gitignore in the current directory\n" +} + dotmg-run () { + [[ "$1" == "add" ]] && shift && dotmg-dont-ignore "$@" && remove-empty-newlines && exit 0 + [[ "$1" == "clean-newlines" ]] && check-gitignore-exists && remove-empty-newlines && exit 0 + [[ "$1" == "help" ]] && dotmg-help && exit 0 [[ "$1" == "init" ]] && dotmg-init "$HOUSE" && exit 0 [[ "$1" == "init-gitignore" ]] && write-base-gitignore && exit 0 - [[ "$1" == "add" ]] && shift && dotmg-dont-ignore "$@" && remove-empty-newlines && exit 0 - [[ "$1" == "clean-newlines" ]] && check-gitignore-exists && remove-empty-newlines && exit 0 # seems useless right now. might remove later. + + # well nothing else then dotmg is wrong used + printf "dotmg: Invalid use\n" + dotmg-help } dotmg-run "$@" diff --git a/man/dotmg.1 b/man/dotmg.1 index 0aaf77b..d12e94d 100644 --- a/man/dotmg.1 +++ b/man/dotmg.1 @@ -6,7 +6,7 @@ dotmg - generate and manage .gitignore entries for the user .SH "SYNOPSIS" .PP -dotmg command [argument...] +dotmg command [argument]... .SH "DESCRIPTION" .PP @@ -21,21 +21,25 @@ and bother with manually adding/removing listings. Add the specified file or directory argument(s) to not be ignored by git. +.SS "clean-newlines" +.PP +Removes any empty newlines that are present +in .gitignore file in the current directory. + +.SS "help" +.PP +Produce a help message. + .SS "init" .PP -Intialises an git repository in $HOUSE and writes a base -.gitignore that ignores everything in $HOUSE. +Intialises a git repository in $HOUSE and writes a base .gitignore +that ignores everything in $HOUSE. .SS "init-gitignore" .PP Writes only a base .gitignore in the current directory. -.SS "clean-newlines" -.PP -Removes any empty newlines that are present -in .gitignore file in the current directory. - .SH "EXAMPLES" .SS "Adding Files" .PP diff --git a/man/dotmg.1.org b/man/dotmg.1.org index 5e4c1ed..55f357e 100644 --- a/man/dotmg.1.org +++ b/man/dotmg.1.org @@ -6,7 +6,7 @@ dotmg - generate and manage .gitignore entries for the user * SYNOPSIS -dotmg command [argument...] +dotmg command [argument]... * DESCRIPTION This is a simple bash program that automates the generation and @@ -19,18 +19,21 @@ and bother with manually adding/removing listings. Add the specified file or directory argument(s) to not be ignored by git. +** clean-newlines +Removes any empty newlines that are present +in .gitignore file in the current directory. + +** help +Produce a help message. + ** init -Intialises an git repository in $HOUSE and writes a base -.gitignore that ignores everything in $HOUSE. +Intialises a git repository in $HOUSE and writes a base .gitignore +that ignores everything in $HOUSE. ** init-gitignore Writes only a base .gitignore in the current directory. -** clean-newlines -Removes any empty newlines that are present -in .gitignore file in the current directory. - * EXAMPLES ** Adding Files