1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//!# BashDoc
//!
//!A tool for generating documentation/help menu for ~~user defined bash functions~~ any folder or file with 6 generic delimiters defined.
//!
//!## Syntax
//!
//!### Example
//!
//! Using syntax similar to below
//!
//!```bash
//!#;
//!# cd()
//!# moves to given directory
//!# @param directory: folder to move to
//!# @return void
//!#"
//!cd() {
//! cd $1
//!}
//!```
//!
//!on my `zshrc` Outputs
//!
//!
//!
//!with lots of color!
//!
//!### Global Delimiters
//!
//! The default delimiters to use are as follows:
//!
//!`START_DELIM = #;`
//!
//!`END_DELIM = #"`
//!
//!`PAR_DELIM = @param`
//!
//!`RET_DELIM = @return`
//!
//!`OPT_DELIM = # -`
//!
//!`COMM_DELIM = #`
//!
//!These can be modifed in your `.bashdocrc`.
//!
//!## Install
//!
//! ```bash
//! cargo install bashdoc
//! ```
//!
//! or from source
//!
//!**NOTE: Must use Rust 2018 Edition**
//!
//!_update with `rustup update stable`_
//!
//!```bash
//!git clone https://github.com/dustinknopoff/bashdoc
//!cd bashdoc
//!cargo install --path . --force
//!```
//!
//!## Usage
//!
//!```bash
//!bashdoc 0.4.10
//!Creates a "javadoc" like structure for bash. See github repo github.com/dustinknopoff/bashdoc for information on formatting.
//!
//!USAGE:
//!bashdoc [FLAGS] [OPTIONS] <INPUT> [SUBCOMMAND]
//!
//!FLAGS:
//!-c, --color toggles color
//!-h, --help Prints help information
//!-V, --version Prints version information
//!-w, --watch continuously update on change
//!
//!OPTIONS:
//!-j, --json <FILE> print result as JSON
//!-l, --location <location> location to save HTML
//!-t, --template <template> .hbs template to use for generation of documentation
//!
//!ARGS:
//!<INPUT> Sets the input file or glob pattern to use
//!
//!SUBCOMMANDS:
//!help Prints this message or the help of the given subcommand(s)
//!override override the delimiters
//!```
//!
//! See the [examples](https://github.com/dustinknopoff/bashdoc/tree/master/example) folder for more.
//!
//! See the [changelog](https://github.com/dustinknopoff/bashdoc/blob/master/CHANGELOG.md) for updates
//!
//! # Changelog
//!
//!- v0.4.0 - Added to crates.io
//!- v0.4.1/v0.4.2 - Better descriptions for crates.io
//!- v.0.4.5 - Fix error where bashdoc would not function for users without a `~/.bashdocrc`
//!- v.0.4.6 - Improved Error handling, `--html` argument removed replaced with `--location`, `--template` argument added for supplying custom `.hbs`
//!- v0.4.7 - Fix required location for all inputs and not exclusive to `--location`
//!- v0.4.8 - Clearer README, link to docs.rs documentation
//!- v0.4.9 - Improved error path handling
//!- v0.4.10 - Support for windows file paths again
//! - v0.4.11 - support for overriding global `.bashdocrc` within a directory.
//! - v0.4.12 - descriptors can be split on ':' or whitespace
//! - v0.5.0 - refactor for improved error handling/rust-ic code
use crate*;
use ;