Skip to content

Commit

Permalink
help argument
Browse files Browse the repository at this point in the history
  • Loading branch information
icebarf committed Jun 26, 2023
1 parent 24cf355 commit b1a8ac8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 17 deletions.
19 changes: 17 additions & 2 deletions dotmg
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
20 changes: 12 additions & 8 deletions man/dotmg.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 10 additions & 7 deletions man/dotmg.1.org
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b1a8ac8

Please sign in to comment.