-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 93da82a
Showing
13 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
# end_of_line = git | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.py] | ||
indent_size = 4 | ||
indent_style = space | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
# Created by https://www.gitignore.io/api/windows,osx,linux,git | ||
|
||
### OSX ### | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
# Thumbnails | ||
._* | ||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
|
||
### Git ### | ||
*.orig | ||
|
||
### Custom ### | ||
deps/ | ||
wiki/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Change Log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Contributing | ||
Contributions are welcome, and they are greatly appreciated! | ||
|
||
Every little bit helps, and credit will always be given. | ||
|
||
## Types of Contributions | ||
|
||
### Bug Reports, Feature Requests, and Feedback | ||
Create a [new project issue][1]! Try to be as descriptive as possible. | ||
|
||
### Bug Fixes, New Features and Documentation | ||
Create a [new merge/pull request][2]! Make sure to follow the guidelines. | ||
|
||
## Merge/Pull Request Guidelines | ||
Make sure to have atomic commits and contextual commit messages! | ||
|
||
[Check out this awesome blog post by Chris Beams for more information.][3] | ||
|
||
[1]: https://gitlab.com/shellm/doc/issues/new | ||
[2]: https://github.com/shellm/doc/merge_requests/new | ||
[3]: http://chris.beams.io/posts/git-commit/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ISC License | ||
|
||
Copyright (c) 2018, Timothée Mazzucotelli | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.PHONY: rmdoc | ||
|
||
BINDIR := bin | ||
LIBDIR := lib | ||
MANDIR := man | ||
WIKIDIR := wiki | ||
|
||
MANPAGES := $(addprefix $(MANDIR)/,doc.1 doc.sh.3) | ||
WIKIPAGES := $(addprefix $(WIKIDIR)/,bin/doc.md lib/doc.sh.md) | ||
|
||
ifeq ($(PREFIX), ) | ||
PREFIX := /usr/local | ||
endif | ||
|
||
all : doc | ||
|
||
install : | ||
@./install.sh $(PREFIX) | ||
|
||
$(MANDIR)/%.1 : $(BINDIR)/% | ||
@shellman --format man $< > $@ | ||
|
||
$(MANDIR)/%.sh.3 : $(LIBDIR)/%.sh | ||
@shellman --format man $< > $@ | ||
|
||
$(WIKIDIR)/bin/%.md : $(BINDIR)/% | ||
@shellman --format markdown $< > $@ | ||
|
||
$(WIKIDIR)/lib/%.sh.md : $(LIBDIR)/%.sh | ||
@shellman --format markdown $< > $@ | ||
|
||
man : $(MANPAGES) | ||
|
||
wiki : $(WIKIPAGES) | ||
|
||
doc : man wiki | ||
|
||
rmdoc: | ||
@rm man/* wiki/bin/* wiki/lib/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# doc | ||
Documentation for your shell scripts! | ||
|
||
- Authors: https://gitlab.com/shellm/doc/AUTHORS.md | ||
- Changelog: https://gitlab.com/shellm/doc/CHANGELOG.md | ||
- Contributing: https://gitlab.com/shellm/doc/CONTRIBUTING.md | ||
- Documentation: https://gitlab.com/shellm/doc/wiki | ||
- License: ISC - https://gitlab.com/shellm/doc/LICENSE | ||
|
||
## Installation | ||
Installation with [basher](https://github.com/basherpm/basher): | ||
```bash | ||
basher install shellm/doc | ||
``` | ||
|
||
Installation from source: | ||
```bash | ||
git clone https://gitlab.com/shellm/doc | ||
cd doc | ||
sudo ./install.sh | ||
``` | ||
|
||
## Usage | ||
Command-line: | ||
``` | ||
doc -h | ||
``` | ||
|
||
As a library: | ||
```bash | ||
# with basher's include | ||
include shellm/doc lib/doc.sh | ||
# with shellm's include | ||
shellm-include shellm/doc lib/doc.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
## \brief Documentation for your shell scripts! | ||
|
||
shellm-source shellm/doc | ||
|
||
if [ $# -eq 0 ]; then | ||
doc --print-usage "$0" | ||
exit 1 | ||
fi | ||
|
||
__doc_get() { | ||
local re='^[[:space:]]*##[[:space:]]*[@\]'"$1"'[[:space:]]' | ||
grep "${re}" "$2" | expand | sed 's/'"${re}"'*//' | ||
# shellcheck disable=SC2086 | ||
return ${PIPESTATUS[0]} | ||
} | ||
|
||
main() { | ||
while [ $# -ne 0 ]; do | ||
case "$1" in | ||
## \option -h, --help | ||
## Print this help and exit. | ||
-h|--help) doc --print-help "$0"; exit 0 ;; | ||
|
||
## \option --print-help SCRIPT | ||
## Print help for the given script. | ||
--print-help) | ||
if ! command -v shellman &>/dev/null; then | ||
if ! man "$(basename "$1")"; then | ||
echo "doc: please install shellman dependency with pip install shellman" >&2 | ||
return 1 | ||
fi | ||
return 0 | ||
fi | ||
shellman "$1" | ||
;; | ||
|
||
## \option --print-usage SCRIPT | ||
## Print usage for the given script. | ||
--print-usage) | ||
usages="$(__doc_get usage "$1")" | ||
echo "usage: $(echo "${usages}" | head -n1)" | ||
echo "${usages}" | tail -n+2 | while read -r line; do | ||
echo " ${line}" | ||
done | ||
;; | ||
esac | ||
shift | ||
done | ||
} | ||
|
||
## \usage doc [-h] | ||
main "$@" |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
BINS="bin/doc" | ||
DEPS="gitlab.com/shellm/core" | ||
BASH_COMPLETIONS="cmp/doc.completion.bash" | ||
ZSH_COMPLETIONS="cmp/doc.completion.zsh" |