Skip to content

Commit 93da82a

Browse files
committed
Initial commit
0 parents  commit 93da82a

File tree

13 files changed

+235
-0
lines changed

13 files changed

+235
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
# end_of_line = git
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.py]
12+
indent_size = 4
13+
indent_style = space
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
# Created by https://www.gitignore.io/api/windows,osx,linux,git
3+
4+
### OSX ###
5+
*.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
9+
# Icon must end with two \r
10+
Icon
11+
# Thumbnails
12+
._*
13+
# Files that might appear in the root of a volume
14+
.DocumentRevisions-V100
15+
.fseventsd
16+
.Spotlight-V100
17+
.TemporaryItems
18+
.Trashes
19+
.VolumeIcon.icns
20+
.com.apple.timemachine.donotpresent
21+
# Directories potentially created on remote AFP share
22+
.AppleDB
23+
.AppleDesktop
24+
Network Trash Folder
25+
Temporary Items
26+
.apdisk
27+
28+
29+
### Linux ###
30+
*~
31+
32+
# temporary files which can be created if a process still has a handle open of a deleted file
33+
.fuse_hidden*
34+
35+
# KDE directory preferences
36+
.directory
37+
38+
# Linux trash folder which might appear on any partition or disk
39+
.Trash-*
40+
41+
# .nfs files are created when an open file is removed but is still being accessed
42+
.nfs*
43+
44+
45+
### Git ###
46+
*.orig
47+
48+
### Custom ###
49+
deps/
50+
wiki/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Change Log

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Contributing
2+
Contributions are welcome, and they are greatly appreciated!
3+
4+
Every little bit helps, and credit will always be given.
5+
6+
## Types of Contributions
7+
8+
### Bug Reports, Feature Requests, and Feedback
9+
Create a [new project issue][1]! Try to be as descriptive as possible.
10+
11+
### Bug Fixes, New Features and Documentation
12+
Create a [new merge/pull request][2]! Make sure to follow the guidelines.
13+
14+
## Merge/Pull Request Guidelines
15+
Make sure to have atomic commits and contextual commit messages!
16+
17+
[Check out this awesome blog post by Chris Beams for more information.][3]
18+
19+
[1]: https://gitlab.com/shellm/doc/issues/new
20+
[2]: https://github.com/shellm/doc/merge_requests/new
21+
[3]: http://chris.beams.io/posts/git-commit/

LICENSE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright (c) 2018, Timothée Mazzucotelli
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.PHONY: rmdoc
2+
3+
BINDIR := bin
4+
LIBDIR := lib
5+
MANDIR := man
6+
WIKIDIR := wiki
7+
8+
MANPAGES := $(addprefix $(MANDIR)/,doc.1 doc.sh.3)
9+
WIKIPAGES := $(addprefix $(WIKIDIR)/,bin/doc.md lib/doc.sh.md)
10+
11+
ifeq ($(PREFIX), )
12+
PREFIX := /usr/local
13+
endif
14+
15+
all : doc
16+
17+
install :
18+
@./install.sh $(PREFIX)
19+
20+
$(MANDIR)/%.1 : $(BINDIR)/%
21+
@shellman --format man $< > $@
22+
23+
$(MANDIR)/%.sh.3 : $(LIBDIR)/%.sh
24+
@shellman --format man $< > $@
25+
26+
$(WIKIDIR)/bin/%.md : $(BINDIR)/%
27+
@shellman --format markdown $< > $@
28+
29+
$(WIKIDIR)/lib/%.sh.md : $(LIBDIR)/%.sh
30+
@shellman --format markdown $< > $@
31+
32+
man : $(MANPAGES)
33+
34+
wiki : $(WIKIPAGES)
35+
36+
doc : man wiki
37+
38+
rmdoc:
39+
@rm man/* wiki/bin/* wiki/lib/*

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# doc
2+
Documentation for your shell scripts!
3+
4+
- Authors: https://gitlab.com/shellm/doc/AUTHORS.md
5+
- Changelog: https://gitlab.com/shellm/doc/CHANGELOG.md
6+
- Contributing: https://gitlab.com/shellm/doc/CONTRIBUTING.md
7+
- Documentation: https://gitlab.com/shellm/doc/wiki
8+
- License: ISC - https://gitlab.com/shellm/doc/LICENSE
9+
10+
## Installation
11+
Installation with [basher](https://github.com/basherpm/basher):
12+
```bash
13+
basher install shellm/doc
14+
```
15+
16+
Installation from source:
17+
```bash
18+
git clone https://gitlab.com/shellm/doc
19+
cd doc
20+
sudo ./install.sh
21+
```
22+
23+
## Usage
24+
Command-line:
25+
```
26+
doc -h
27+
```
28+
29+
As a library:
30+
```bash
31+
# with basher's include
32+
include shellm/doc lib/doc.sh
33+
# with shellm's include
34+
shellm-include shellm/doc lib/doc.sh
35+
```

bin/doc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
3+
## \brief Documentation for your shell scripts!
4+
5+
shellm-source shellm/doc
6+
7+
if [ $# -eq 0 ]; then
8+
doc --print-usage "$0"
9+
exit 1
10+
fi
11+
12+
__doc_get() {
13+
local re='^[[:space:]]*##[[:space:]]*[@\]'"$1"'[[:space:]]'
14+
grep "${re}" "$2" | expand | sed 's/'"${re}"'*//'
15+
# shellcheck disable=SC2086
16+
return ${PIPESTATUS[0]}
17+
}
18+
19+
main() {
20+
while [ $# -ne 0 ]; do
21+
case "$1" in
22+
## \option -h, --help
23+
## Print this help and exit.
24+
-h|--help) doc --print-help "$0"; exit 0 ;;
25+
26+
## \option --print-help SCRIPT
27+
## Print help for the given script.
28+
--print-help)
29+
if ! command -v shellman &>/dev/null; then
30+
if ! man "$(basename "$1")"; then
31+
echo "doc: please install shellman dependency with pip install shellman" >&2
32+
return 1
33+
fi
34+
return 0
35+
fi
36+
shellman "$1"
37+
;;
38+
39+
## \option --print-usage SCRIPT
40+
## Print usage for the given script.
41+
--print-usage)
42+
usages="$(__doc_get usage "$1")"
43+
echo "usage: $(echo "${usages}" | head -n1)"
44+
echo "${usages}" | tail -n+2 | while read -r line; do
45+
echo " ${line}"
46+
done
47+
;;
48+
esac
49+
shift
50+
done
51+
}
52+
53+
## \usage doc [-h]
54+
main "$@"

cmp/doc.completion.bash

Whitespace-only changes.

cmp/doc.completion.zsh

Whitespace-only changes.

0 commit comments

Comments
 (0)