├── .clog.toml ├── .gitignore ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE ├── README.md ├── _ ├── bashdocrc.toml ├── cli.yml ├── example ├── html.png ├── zshrc └── zshrc.png ├── src ├── docs.rs └── main.rs └── static └── template.hbs /.clog.toml: -------------------------------------------------------------------------------- 1 | [clog] 2 | # A repository link with the trailing '.git' which will be used to generate 3 | # all commit and issue links 4 | repository = "https://github.com/dustinknopoff/bashdoc" 5 | # A constant release title 6 | subtitle = "Bashdoc" 7 | 8 | # specify the style of commit links to generate, defaults to "github" if omitted 9 | link-style = "github" 10 | 11 | # The preferred way to set a constant changelog. This file will be read for old changelog 12 | # data, then prepended to for new changelog data. It's the equivilant to setting 13 | # both infile and outfile to the same file. 14 | # 15 | # Do not use with outfile or infile fields! 16 | # 17 | # Defaults to stdout when omitted 18 | changelog = "CHANGELOG.md" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/vim,visualstudiocode,mac,rust,jetbrains+all 3 | # Edit at https://www.gitignore.io/?templates=vim,visualstudiocode,mac,rust,jetbrains+all 4 | 5 | ### JetBrains+all ### 6 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 7 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 8 | 9 | # User-specific stuff 10 | .idea/**/workspace.xml 11 | .idea/**/tasks.xml 12 | .idea/**/usage.statistics.xml 13 | .idea/**/dictionaries 14 | .idea/**/shelf 15 | 16 | # Generated files 17 | .idea/**/contentModel.xml 18 | 19 | # Sensitive or high-churn files 20 | .idea/**/dataSources/ 21 | .idea/**/dataSources.ids 22 | .idea/**/dataSources.local.xml 23 | .idea/**/sqlDataSources.xml 24 | .idea/**/dynamic.xml 25 | .idea/**/uiDesigner.xml 26 | .idea/**/dbnavigator.xml 27 | 28 | # Gradle 29 | .idea/**/gradle.xml 30 | .idea/**/libraries 31 | 32 | # Gradle and Maven with auto-import 33 | # When using Gradle or Maven with auto-import, you should exclude module files, 34 | # since they will be recreated, and may cause churn. Uncomment if using 35 | # auto-import. 36 | # .idea/modules.xml 37 | # .idea/*.iml 38 | # .idea/modules 39 | 40 | # CMake 41 | cmake-build-*/ 42 | 43 | # Mongo Explorer plugin 44 | .idea/**/mongoSettings.xml 45 | 46 | # File-based project format 47 | *.iws 48 | 49 | # IntelliJ 50 | out/ 51 | 52 | # mpeltonen/sbt-idea plugin 53 | .idea_modules/ 54 | 55 | # JIRA plugin 56 | atlassian-ide-plugin.xml 57 | 58 | # Cursive Clojure plugin 59 | .idea/replstate.xml 60 | 61 | # Crashlytics plugin (for Android Studio and IntelliJ) 62 | com_crashlytics_export_strings.xml 63 | crashlytics.properties 64 | crashlytics-build.properties 65 | fabric.properties 66 | 67 | # Editor-based Rest Client 68 | .idea/httpRequests 69 | 70 | # Android studio 3.1+ serialized cache file 71 | .idea/caches/build_file_checksums.ser 72 | 73 | ### JetBrains+all Patch ### 74 | # Ignores the whole .idea folder and all .iml files 75 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 76 | 77 | .idea/ 78 | 79 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 80 | 81 | *.iml 82 | modules.xml 83 | .idea/misc.xml 84 | *.ipr 85 | 86 | #!! ERROR: mac is undefined. Use list command to see defined gitignore types !!# 87 | 88 | ### Rust ### 89 | # Generated by Cargo 90 | # will have compiled files and executables 91 | /target/ 92 | 93 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 94 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 95 | Cargo.lock 96 | 97 | # These are backup files generated by rustfmt 98 | **/*.rs.bk 99 | 100 | ### Vim ### 101 | # Swap 102 | [._]*.s[a-v][a-z] 103 | [._]*.sw[a-p] 104 | [._]s[a-rt-v][a-z] 105 | [._]ss[a-gi-z] 106 | [._]sw[a-p] 107 | 108 | # Session 109 | Session.vim 110 | 111 | # Temporary 112 | .netrwhist 113 | *~ 114 | # Auto-generated tag files 115 | tags 116 | # Persistent undo 117 | [._]*.un~ 118 | 119 | ### VisualStudioCode ### 120 | .vscode/* 121 | !.vscode/settings.json 122 | !.vscode/tasks.json 123 | !.vscode/launch.json 124 | !.vscode/extensions.json 125 | 126 | ### VisualStudioCode Patch ### 127 | # Ignore all local history of files 128 | .history 129 | 130 | # End of https://www.gitignore.io/api/vim,visualstudiocode,mac,rust,jetbrains+all 131 | 132 | # Created by https://www.gitignore.io/api/macos 133 | # Edit at https://www.gitignore.io/?templates=macos 134 | 135 | ### macOS ### 136 | # General 137 | .DS_Store 138 | .AppleDouble 139 | .LSOverride 140 | 141 | # Icon must end with two \r 142 | Icon 143 | 144 | # Thumbnails 145 | ._* 146 | 147 | # Files that might appear in the root of a volume 148 | .DocumentRevisions-V100 149 | .fseventsd 150 | .Spotlight-V100 151 | .TemporaryItems 152 | .Trashes 153 | .VolumeIcon.icns 154 | .com.apple.timemachine.donotpresent 155 | 156 | # Directories potentially created on remote AFP share 157 | .AppleDB 158 | .AppleDesktop 159 | Network Trash Folder 160 | Temporary Items 161 | .apdisk 162 | 163 | # End of https://www.gitignore.io/api/macos 164 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Bashdoc (2018-12-25) 4 | 5 | #### Performance 6 | 7 | - **generate_doc_file:** Parallelize Doc generation ([984e546e](https://github.com/dustinknopoff/bashdoc/commit/984e546e19aed5aec4ad91d6cf4b506b03c31d42)) 8 | 9 | #### Bug Fixes 10 | 11 | - **0.4.0:** ([31d2454b](https://github.com/dustinknopoff/bashdoc/commit/31d2454bcb44a074c2b22e1c58ff38a64f78a830)) 12 | - **All:** Apply clippy fixes ([bca0b613](https://github.com/dustinknopoff/bashdoc/commit/bca0b613adc82452bfb3c70cfe15c205d5b74816)) 13 | - **Cargo.toml:** 14 | - version bump for cargo ([b7b5e624](https://github.com/dustinknopoff/bashdoc/commit/b7b5e62481ff4e448a7d49c12321e941beeced6c)) 15 | - Version bump to update cargo ([0bbd48aa](https://github.com/dustinknopoff/bashdoc/commit/0bbd48aab4500b2b6ee81f39c63453a745231db0)) 16 | - Experimental badge ([075a9d68](https://github.com/dustinknopoff/bashdoc/commit/075a9d68be855ced117cf1f60b30629c2b408488)) 17 | - Metadata for publishing added ([8fda35d6](https://github.com/dustinknopoff/bashdoc/commit/8fda35d68637380499b8aaf515570bc7e41cafc3)) 18 | - Remove email ([29d67053](https://github.com/dustinknopoff/bashdoc/commit/29d67053bb62e31458a9be9635b6fdb078f52639)) 19 | - **Clippy:** Allow Cyclomatic Complexity on nom parser ([6ce68ec9](https://github.com/dustinknopoff/bashdoc/commit/6ce68ec90e0525977b716ce579a24d64b491ca33)) 20 | - **Delimiters:** descriptors can split on things other than whitespace ([15c704b9](https://github.com/dustinknopoff/bashdoc/commit/15c704b97754314f1577a1d7f1630bd2bfa2174e)) 21 | - **Docs:** Better md formatting ([8d4df95b](https://github.com/dustinknopoff/bashdoc/commit/8d4df95b3759f9ec9472c7322f3229f297fae22f)) 22 | - **README:** 23 | - include cargo install instructions ([5c504667](https://github.com/dustinknopoff/bashdoc/commit/5c5046676c2842a7dbcaedc80f47c1b1a365039c)) 24 | - code blocks should be highlighted for bash not rust ([62db2ad2](https://github.com/dustinknopoff/bashdoc/commit/62db2ad2f253c25517268ff7ead595f4c73f063d)) 25 | - **Support windows again:** ([46f6267a](https://github.com/dustinknopoff/bashdoc/commit/46f6267a074f0024c960d29d5e92ce0fd76848a1)) 26 | - **Watcher:** Better information on watching files ([fbde071d](https://github.com/dustinknopoff/bashdoc/commit/fbde071d0d578bfa0d64e73984593ab5a200a368)) 27 | - **Windows:** only replace ~ with home_dir if ~ in path ([b192b8a0](https://github.com/dustinknopoff/bashdoc/commit/b192b8a01bec0b85a0762b4ac52d3b92ebf2068f)) 28 | - **Windows support re-added:** ([ca69c443](https://github.com/dustinknopoff/bashdoc/commit/ca69c443acd035bb6b7a3e6df7a975a9908c4f42)) 29 | - **cargo.toml:** Specify files to package ([6d99b502](https://github.com/dustinknopoff/bashdoc/commit/6d99b502cb08b108b80b907d618c4bc13326f528)) 30 | - **cli:** Removed requirement for `--location` on all calls ([e93d9144](https://github.com/dustinknopoff/bashdoc/commit/e93d9144979bffe8c36dffc1199cf8805752ee7e)) 31 | - **cli.yml:** Keep version numbers consistent ([0347fd80](https://github.com/dustinknopoff/bashdoc/commit/0347fd804d36cd9c39debcd50fb9878d763b96fc)) 32 | - **clippy:** implement clippy suggestions ([4f59d771](https://github.com/dustinknopoff/bashdoc/commit/4f59d7713ad4de2abb9188b63c6a2569d678b927)) 33 | - **delimiters:** Resolves iisue where user with no BASHDOC_CONFIG_PATH caused a panic ([8738852d](https://github.com/dustinknopoff/bashdoc/commit/8738852d8acc453b3ee1947da3f7b18fdc147a72)) 34 | - **demo:** remove old examples ([dea6213a](https://github.com/dustinknopoff/bashdoc/commit/dea6213abb5eec5165504b3bd0dab183e879e2ba)) 35 | - **docs.rs:** Remove debug printlns ([50b35b08](https://github.com/dustinknopoff/bashdoc/commit/50b35b08d64c06800359babb5823e7af7e94782f)) 36 | - **example:** 37 | - weird coloring ([bb2be77c](https://github.com/dustinknopoff/bashdoc/commit/bb2be77cfa59527ec595abdc24d035f3f34c048d)) 38 | - fixes ([bd1d76bd](https://github.com/dustinknopoff/bashdoc/commit/bd1d76bdac0fb0ebd9c3ea2d770eadfcb8f19002)) 39 | - **header:** Improved header looks ([b8f5433c](https://github.com/dustinknopoff/bashdoc/commit/b8f5433c2100d2172699cc32606b4bd15eaea96c)) 40 | - **html:** remove example html to stop inflation of html in repo ([e9965c58](https://github.com/dustinknopoff/bashdoc/commit/e9965c58df218db21b6fe04d05748a10d132d334)) 41 | - **screenshot:** ([87d31b24](https://github.com/dustinknopoff/bashdoc/commit/87d31b2469614f92ca1a42fa81d08d590692a610)) 42 | - **static:** remove unnecessary CSS files ([38b6f064](https://github.com/dustinknopoff/bashdoc/commit/38b6f06476e8ecaba05c497cda3022bec6fa8d5d)) 43 | 44 | #### Features 45 | 46 | - **Delimiters:** override global .bashdocrc within a directory ([45517f6d](https://github.com/dustinknopoff/bashdoc/commit/45517f6d7b2be21d3510c4c008cc63ea99653c12)) 47 | - **Extracted:** Parsing of bashdocs from text now includes the line number of the function extract ([0ce89d6e](https://github.com/dustinknopoff/bashdoc/commit/0ce89d6e65efd4852b79aecf89a37d746922f4bf)) 48 | - **Windows:** support for windows filepaths ([fec2de62](https://github.com/dustinknopoff/bashdoc/commit/fec2de6235b82c18ebaf839aa0e736196850ab40)) 49 | - **cli.yml:** Can provide a custom template for html documentation ([05936821](https://github.com/dustinknopoff/bashdoc/commit/059368217d8f155662a1ee3e156d0e0e373c2c03), breaks [#](https://github.com/dustinknopoff/bashdoc/issues/)) 50 | - **docs.rs:** Upgrade to 2018 edition, move to nom for parsing ([e7b0541b](https://github.com/dustinknopoff/bashdoc/commit/e7b0541b5fe26db23198e15100916f0d59fbeeae)) 51 | - **output HTML:** 52 | - Basic example of outputting html documentation of a bashdoc call ([0155a3e8](https://github.com/dustinknopoff/bashdoc/commit/0155a3e84058b2378b8c0dfc7b37e62c2a3bda7e)) 53 | - Extremely bare example of creating html documentation from a bashdoc call ([030645ef](https://github.com/dustinknopoff/bashdoc/commit/030645ef8fc1c2d66e4095c14146c6ac9f6ec8d7)) 54 | - **script.js:** 55 | - Highlight clicked on function ([5bab275c](https://github.com/dustinknopoff/bashdoc/commit/5bab275cf8fb291934122d7bc9520733530a775b)) 56 | - Highlight clicked on function ([b8d25409](https://github.com/dustinknopoff/bashdoc/commit/b8d25409d328ad1d282ba45c58b3a19f0630166b)) 57 | 58 | #### Breaking Changes 59 | 60 | - **cli.yml:** Can provide a custom template for html documentation ([05936821](https://github.com/dustinknopoff/bashdoc/commit/059368217d8f155662a1ee3e156d0e0e373c2c03), breaks [#](https://github.com/dustinknopoff/bashdoc/issues/)) 61 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bashdoc" 3 | version = "0.6.0" 4 | authors = ["Dustin Knopoff "] 5 | description = """ 6 | A tool for generating documentation/help menu for user defined bash functions. 7 | """ 8 | edition = "2018" 9 | homepage = "https://github.com/dustinknopoff/bashdoc" 10 | repository = "https://github.com/dustinknopoff/bashdoc" 11 | documentation = "https://docs.rs/crate/bashdoc" 12 | readme = "README.md" 13 | keywords = ["bash", "docs", "documentation"] 14 | categories = ["command-line-utilities", "text-processing"] 15 | license = "MIT" 16 | exclude = ["example/**", ".idea/**", "backdocrc.toml", ".clog.toml"] 17 | 18 | [badges] 19 | maintenance = { status = "experimental" } 20 | 21 | [dependencies] 22 | colored = "1.7.0" 23 | dirs = "1.0.4" 24 | clap = { version = "2.32.0", features = ["yaml"] } 25 | glob = "0.2.11" 26 | rayon = "1.0.3" 27 | serde = { version = "1.0.87", features = ["derive"] } 28 | serde_json = "1.0.38" 29 | toml = "0.4.10" 30 | nom = "4.2.0" 31 | handlebars = "1.1.0" 32 | notify = "4.0.9" 33 | nom_locate = "0.3.1" 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dustin Knopoff 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bashdoc 2 | 3 | ## BashDoc 4 | 5 | A tool for generating documentation/help menu for ~~user defined bash functions~~ any folder or file with 6 generic delimiters defined. 6 | 7 | ### Syntax 8 | 9 | #### Example 10 | 11 | Using syntax similar to below 12 | 13 | ```bash 14 | #; 15 | # cd() 16 | # moves to given directory 17 | # @param directory: folder to move to 18 | # @return void 19 | #" 20 | cd() { 21 | cd $1 22 | } 23 | ``` 24 | 25 | on my `zshrc` Outputs 26 | 27 | ![](https://github.com/dustinknopoff/bashdoc/raw/master/example/zshrc.png) 28 | 29 | with lots of color! 30 | 31 | #### Global Delimiters 32 | 33 | The default delimiters to use are as follows: 34 | 35 | `START_DELIM = #;` 36 | 37 | `END_DELIM = #"` 38 | 39 | `PAR_DELIM = @param` 40 | 41 | `RET_DELIM = @return` 42 | 43 | `OPT_DELIM = # -` 44 | 45 | `COMM_DELIM = #` 46 | 47 | These can be modifed in your `.bashdocrc`. 48 | 49 | ### Install 50 | 51 | ```bash 52 | cargo install bashdoc 53 | ``` 54 | 55 | or from source 56 | 57 | **NOTE: Must use Rust 2018 Edition** 58 | 59 | _update with `rustup update stable`_ 60 | 61 | ```bash 62 | git clone https://github.com/dustinknopoff/bashdoc 63 | cd bashdoc 64 | cargo install --path . --force 65 | ``` 66 | 67 | ### Usage 68 | 69 | ```bash 70 | bashdoc 0.4.10 71 | Creates a "javadoc" like structure for bash. See github repo github.com/dustinknopoff/bashdoc for information on formatting. 72 | 73 | USAGE: 74 | bashdoc [FLAGS] [OPTIONS] [SUBCOMMAND] 75 | 76 | FLAGS: 77 | -c, --color toggles color 78 | -h, --help Prints help information 79 | -V, --version Prints version information 80 | -w, --watch continuously update on change 81 | 82 | OPTIONS: 83 | -j, --json print result as JSON 84 | -l, --location location to save HTML 85 | -t, --template