├── .all-contributorsrc ├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .gitmodules ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── doc.go ├── docli.go ├── docs ├── config.yml ├── content │ ├── _index.md │ ├── docs │ │ ├── feedback │ │ │ └── index.md │ │ ├── installation │ │ │ └── index.md │ │ ├── tutorial │ │ │ └── index.md │ │ └── unsupported-features │ │ │ └── index.md │ └── menu │ │ └── index.md ├── layouts │ └── partials │ │ └── docs │ │ ├── brand.html │ │ └── inject │ │ ├── head.html │ │ └── menu-after.html ├── public │ ├── 404.html │ ├── avatar.png │ ├── book.min.29d743ffb6d61ecbfc9bb21b7eab17d63b577d4bd547c3f095addb1c793ab1b1.css │ ├── book.min.95d69eb6bad8b9707ff2b5d8d9e31ce70a1b84f2ed7ffaf665ffcf00aa7993bd.css │ ├── book.min.dd0f25ca71c9192648088113f8cdb8d63a2fbebc903768fb79ee24bc87357c98.css │ ├── docs │ │ ├── feedback │ │ │ └── index.html │ │ ├── index.html │ │ ├── index.xml │ │ ├── installation │ │ │ └── index.html │ │ ├── license │ │ │ └── index.html │ │ ├── tutorial │ │ │ └── index.html │ │ └── unsupported-features │ │ │ └── index.html │ ├── en.search-data.min.2e4816fcf335f19843d3e87d03c3ffbb98d6cc8dac625000b49e5493642d1265.json │ ├── en.search-data.min.b7c721dd1bec1696af0abc4157baf0d185c534cdcc71d9a1ce52329b7ec6da43.json │ ├── en.search-data.min.e590e8c46a909cea153ae2ea57829c489ba98d785de4512d3fc3650c9ee2e0ad.json │ ├── en.search-data.min.eede715b4a6d62ae010148ceeaeb809fca5a0b0d743a280dd9c411fecf86d5dd.json │ ├── en.search.min.055211035e76540870f517153dc4d92a1bb55b5d44ef3c659de97821b47f221e.js │ ├── en.search.min.0cd04d6a90707e870433c7aac59a3f0ecde0f01ccd88395162b53d7d5d87535c.js │ ├── en.search.min.551ad11ad4c428fd22af05a79645e08ed16760f970190c22749f37b3ff76b790.js │ ├── en.search.min.ccd1416a9f4d5c223125235f4930c17094838c6bbc76296c7b6380ea70d0061f.js │ ├── favicon.png │ ├── favicon.svg │ ├── flexsearch.min.js │ ├── fonts │ │ ├── roboto-mono-v13-latin-regular.woff │ │ ├── roboto-mono-v13-latin-regular.woff2 │ │ ├── roboto-v27-latin-700.woff │ │ ├── roboto-v27-latin-700.woff2 │ │ ├── roboto-v27-latin-regular.woff │ │ └── roboto-v27-latin-regular.woff2 │ ├── index.html │ ├── index.xml │ ├── katex │ │ ├── auto-render.min.js │ │ ├── fonts │ │ │ ├── KaTeX_AMS-Regular.ttf │ │ │ ├── KaTeX_AMS-Regular.woff │ │ │ ├── KaTeX_AMS-Regular.woff2 │ │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ │ ├── KaTeX_Fraktur-Bold.woff │ │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ │ ├── KaTeX_Fraktur-Regular.woff │ │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ │ ├── KaTeX_Main-Bold.ttf │ │ │ ├── KaTeX_Main-Bold.woff │ │ │ ├── KaTeX_Main-Bold.woff2 │ │ │ ├── KaTeX_Main-BoldItalic.ttf │ │ │ ├── KaTeX_Main-BoldItalic.woff │ │ │ ├── KaTeX_Main-BoldItalic.woff2 │ │ │ ├── KaTeX_Main-Italic.ttf │ │ │ ├── KaTeX_Main-Italic.woff │ │ │ ├── KaTeX_Main-Italic.woff2 │ │ │ ├── KaTeX_Main-Regular.ttf │ │ │ ├── KaTeX_Main-Regular.woff │ │ │ ├── KaTeX_Main-Regular.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ │ ├── KaTeX_Math-BoldItalic.woff │ │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ │ ├── KaTeX_Math-Italic.ttf │ │ │ ├── KaTeX_Math-Italic.woff │ │ │ ├── KaTeX_Math-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ │ ├── KaTeX_SansSerif-Bold.woff │ │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ │ ├── KaTeX_SansSerif-Italic.woff │ │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ │ ├── KaTeX_SansSerif-Regular.woff │ │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ │ ├── KaTeX_Script-Regular.ttf │ │ │ ├── KaTeX_Script-Regular.woff │ │ │ ├── KaTeX_Script-Regular.woff2 │ │ │ ├── KaTeX_Size1-Regular.ttf │ │ │ ├── KaTeX_Size1-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.woff2 │ │ │ ├── KaTeX_Size2-Regular.ttf │ │ │ ├── KaTeX_Size2-Regular.woff │ │ │ ├── KaTeX_Size2-Regular.woff2 │ │ │ ├── KaTeX_Size3-Regular.ttf │ │ │ ├── KaTeX_Size3-Regular.woff │ │ │ ├── KaTeX_Size3-Regular.woff2 │ │ │ ├── KaTeX_Size4-Regular.ttf │ │ │ ├── KaTeX_Size4-Regular.woff │ │ │ ├── KaTeX_Size4-Regular.woff2 │ │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ │ ├── KaTeX_Typewriter-Regular.woff │ │ │ └── KaTeX_Typewriter-Regular.woff2 │ │ ├── katex.min.css │ │ └── katex.min.js │ ├── manifest.json │ ├── mermaid.min.js │ ├── normalize.min.css │ ├── sitemap.xml │ └── svg │ │ ├── calendar.svg │ │ ├── code-fork.svg │ │ ├── code-merge.svg │ │ ├── edit.svg │ │ ├── menu.svg │ │ ├── toc.svg │ │ └── translate.svg ├── resources │ └── _gen │ │ └── assets │ │ └── scss │ │ ├── book.scss_48b060fe05b0a273d182ef83c0605941.content │ │ ├── book.scss_48b060fe05b0a273d182ef83c0605941.json │ │ ├── book.scss_50fc8c04e12a2f59027287995557ceff.content │ │ └── book.scss_50fc8c04e12a2f59027287995557ceff.json └── static │ └── avatar.png ├── examples └── git │ ├── cmd │ ├── clone.go │ └── root.go │ └── main.go ├── go.mod ├── go.sum ├── internal └── reger │ └── reger.go ├── pkg ├── args │ ├── args.go │ ├── args_test.go │ ├── command.go │ ├── errors.go │ ├── grammar.go │ └── grammar_test.go └── docstring │ ├── docstring.go │ ├── docstring_test.go │ ├── grammar.go │ └── grammar_test.go └── revive.toml /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "docli", 3 | "projectOwner": "celicoo", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": [ 7 | "README.md" 8 | ], 9 | "imageSize": 75, 10 | "commit": false, 11 | "contributors": [ 12 | { 13 | "login": "ri0t", 14 | "name": "riot", 15 | "avatar_url": "https://avatars0.githubusercontent.com/u/1938065?v=4", 16 | "profile": "https://github.com/ri0t", 17 | "contributions": [ 18 | "doc" 19 | ] 20 | } 21 | ], 22 | "contributorsPerLine": 7 23 | } 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | ## Description 9 | 13 | 14 | ## Expected behavior 15 | 16 | 20 | 21 | ## Actual behavior 22 | 26 | 27 | ## Possible Fix 28 | 31 | 32 | ## Your environment 33 | 34 | * Version used: 35 | * Link to your project: 36 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 4 | 5 | ## Checklist: 6 | 10 | - [ ] I have added tests to cover my changes 11 | - [ ] All new and existing tests passed 12 | - [ ] My change requires a change to the documentation 13 | - [ ] I have updated the documentation accordingly 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins. 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c`. 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE. 12 | *.out 13 | 14 | # Dependency directories. 15 | vendor/ 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "docs/themes/book"] 2 | path = docs/themes/book 3 | url = https://github.com/alex-shpak/hugo-book 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | env: 4 | - PACKAGES=$(go list ./... | grep -v /examples/) 5 | 6 | go: 7 | - 1.13.x 8 | 9 | git: 10 | depth: 1 11 | 12 | matrix: 13 | fast_finish: true 14 | 15 | before_install: 16 | - go get github.com/mgechev/revive 17 | 18 | install: 19 | - go get -t -v $PACKAGES 20 | 21 | script: 22 | - test -z "$(revive -config revive.toml $PACKAGES)" 23 | - go test -v -race -covermode=atomic -coverprofile=coverage.txt $PACKAGES 24 | # - go vet ./... 25 | 26 | after_success: 27 | - bash <(curl -s https://codecov.io/bash) 28 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | me@celicoo.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

Docli

3 | Docli 4 |

5 | 6 | Build Status 7 | 8 | 9 | 10 | 11 | 12 | GoDoc 13 | 14 | 15 | All Contributors 16 | 17 |

18 |
19 | 20 | Docli is a declarative language for describing command-line interfaces in Go programs. It cuts down the boilerplate to the bare minimum so you're free to move on to the actual reason you're making the app in the first place. 21 | 22 | Docli is 100% inspired by [docopt](https://github.com/docopt/docopt.go). 23 | 24 | - [Documentation](https://docli.dev) 25 | - [Tutorial](https://docli.dev/docs/tutorial) 26 | - [Bug tracker](https://github.com/celicoo/docli/issues) 27 | 28 | ## Contributors 29 | 30 | Thanks go to these wonderful people: 31 | 32 | 33 | 34 |
riot
riot

📖
35 | 36 | 37 | 38 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! 39 | -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | // Package docli is declarative language for describing command-line interfaces 2 | // in Go programs. It cuts down the boilerplate to the very minimum, so you're 3 | // free to move on to the reason why you're making the app in the first place. 4 | // Docli is 100% inspired by docopt. 5 | package docli 6 | -------------------------------------------------------------------------------- /docli.go: -------------------------------------------------------------------------------- 1 | package docli 2 | 3 | import "github.com/celicoo/docli/v2/pkg/args" 4 | 5 | // Args returns the AST of the command-line arguments, starting after the 6 | // program name. 7 | func Args() args.Args { 8 | return args.Parse() 9 | } 10 | -------------------------------------------------------------------------------- /docs/config.yml: -------------------------------------------------------------------------------- 1 | baseURL: https://docli.dev 2 | languageCode: en-us 3 | title: Docli 4 | googleAnalytics: UA-135349489-1 5 | theme: book 6 | enableGitInfo: true 7 | enableEmoji: true 8 | disableKinds: 9 | - taxonomy 10 | - taxonomyTerm 11 | 12 | params: 13 | bookEditPath: edit/master/docs/content 14 | bookMenuBundle: /menu 15 | bookRepo: https://github.com/celicoo/docli 16 | bookTheme: auto 17 | logo: /avatar.png 18 | -------------------------------------------------------------------------------- /docs/content/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduction 3 | type: docs 4 | --- 5 | 6 | # Introduction 7 | 8 | [![Build Status](https://api.travis-ci.com/celicoo/docli.svg?branch=main)](https://app.travis-ci.com/celicoo/docli) 9 | [![GoDoc](https://godoc.org/github.com/celicoo/docli/v2?status.svg)](https://godoc.org/github.com/celicoo/docli/v2) 10 | 11 | Welcome to the official Docli documentation. Here you'll learn how to use Docli for your next project. 12 | 13 | ## What is Docli? 14 | 15 | Docli is a declarative language for describing command-line interfaces in Go programs. It cuts down the boilerplate to the bare minimum so you're free to move on to the actual reason you're making the app in the first place. 16 | 17 | Docli is 100% inspired by [docopt](https://github.com/docopt/docopt.go). 18 | 19 | ## Getting started 20 | 21 | The easiest way to get started with Docli is by following the [Tutorial]({{< relref "/docs/tutorial" >}}). To make the most out of it, you should have a working knowledge of: 22 | 23 | - [Errors](https://gobyexample.com/errors) 24 | - [Interfaces](https://gobyexample.com/interfaces) 25 | - [Pointers](https://gobyexample.com/pointers) 26 | - [Structs](https://gobyexample.com/structs) 27 | 28 | Good luck. 29 | -------------------------------------------------------------------------------- /docs/content/docs/feedback/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Feedback 3 | --- 4 | 5 | # Feedback 6 | 7 | Feel free to send me feedback on [Twitter](https://twitter.com/celicoo) or [file an issue](https://github.com/celicoo/docli/issues). Feature requests and contributions are always welcome. 8 | -------------------------------------------------------------------------------- /docs/content/docs/installation/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Installation 3 | --- 4 | 5 | # Installation 6 | 7 | Currently, **Docli requires Go version 1.13 or greater**. You can install Docli with a single command using `go get`, the Go package manager. Type this into your terminal: 8 | 9 | {{}} 10 | $ go get -u github.com/celicoo/docli/v2@latest 11 | {{}} 12 | 13 | Don't have Go installed? [Learn how to install Go here](https://golang.org/doc/install). 14 | -------------------------------------------------------------------------------- /docs/content/docs/tutorial/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Tutorial 3 | --- 4 | 5 | # Tutorial 6 | 7 | Welcome to the Docli Tutorial! Here you'll be introduced to the key Docli concepts. If you get stuck at any point in 8 | the process, feel free to [download](https://github.com/celicoo/docli/tree/main/examples/git) a working example of the 9 | completed CLI app. 10 | 11 | ## Confirming that Docli is installed 12 | 13 | Before starting the tutorial, let's make sure that you have Docli installed. Go ahead and create a `main.go` file and paste the following content inside: 14 | 15 | {{}} 16 | package main 17 | 18 | import ( 19 | "github.com/alecthomas/repr" 20 | "github.com/celicoo/docli/v2" 21 | ) 22 | 23 | func main() { 24 | args := docli.Args() 25 | repr.Println(args) 26 | } 27 | {{}} 28 | 29 | Now build and run it: 30 | 31 | {{}} 32 | $ go build 33 | $ ./main 34 | 35 | docli.args{ 36 | } 37 | {{}} 38 | 39 | **Note**: the output is the [Abstract Syntax Structure](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of the command-line arguments, and it's empty because you didn't pass any arguments. If you run it again passing arguments you should see a different output. 40 | 41 | ## Creating a new CLI app 42 | 43 | ### Directory structure 44 | 45 | If you like [Cobra](http://cobra.dev), you'll feel at home with this. While you're welcome to provide your own organization, typically a Docli-based app will follow the following directory structure: 46 | 47 | {{< highlight text >}} 48 | ▾ app/ 49 | ▾ cmd/ 50 | root.go 51 | main.go 52 | {{< /highlight >}} 53 | 54 | Go ahead and create the above structure, but instead of `app`, let's name the root directory to `git`. 55 | 56 | #### **app/** 57 | 58 | This is the root of our app. The `main.go` file goes into this directory and it's responsible for calling the function that initializes Docli: 59 | 60 | {{}} 61 | package main 62 | 63 | import "/git" 64 | 65 | func main() { 66 | cmd.Execute() 67 | } 68 | {{}} 69 | 70 | **Note**: Make sure to replace the `` placeholder. 71 | 72 | #### **cmd/** 73 | 74 | This is where the commands are stored. The `root.go` is responsible for the logic of the **root command** and the `Execute()` function: 75 | 76 | {{}} 77 | package cmd 78 | 79 | const version = "0.0.1" 80 | 81 | type Git struct {} 82 | 83 | func (g *Git) Doc() string { 84 | return "" 85 | } 86 | 87 | func (g *Git) Run() { 88 | } 89 | 90 | func (g *Git) Help() { 91 | } 92 | 93 | func (g *Git) Error(err error) { 94 | } 95 | 96 | func Execute() { 97 | } 98 | {{}} 99 | 100 | The `Git` struct represents the root command in our CLI app and it must implement the [docli.command](/) interface. 101 | 102 | ### Writing the docstring 103 | 104 | Like YAML or Python, the docstring is a line-oriented language that uses indentation to define structure. Lines beginning with either spaces or tabs are used to register arguments and commands (commands are explained a little later in the tutorial). These arguments and commands can have letters of any language, numbers, and dashes. 105 | 106 | Let’s go back to the root.go file and replace the [Doc()](/) method of our Git struct with: 107 | 108 | {{}} 109 | func (g *Git) Doc() string { 110 | return `usage: git 111 | 112 | commands: 113 | c, clone clone a repository into a new directory 114 | 115 | arguments: 116 | 117 | v, --version print version 118 | 119 | Use "git help" for more information about the .` 120 | } 121 | {{}} 122 | 123 | By convention, dashes are used in front of arguments, but not commands. You can use this convention with Docli, but it's not necessary. 124 | 125 | ### Accessing command-line argument values 126 | 127 | Now that we’ve registered the arguments and commands in the docstring, we’ll need to define them as fields in the `Git` struct, so we can access their values. Fields that represent arguments will be primitive types and those that represent commands will be user-defined types that implement the [docli.command](/) interface, just like the root command does. 128 | 129 | Regardless of how many aliases your arguments or commands have , you'll only need to (and only should) define one field in the struct. We suggest using the longer identifier, but you can use whichever you’d like. 130 | 131 | In our example, we have one command and one argument, and each has two identifiers. Let’s add these to our `Git` struct: 132 | 133 | {{}} 134 | type Git struct { 135 | Clone Clone 136 | Version bool 137 | } 138 | {{}} 139 | 140 | For every command, you’ll need to create a file to hold the type that represents the command. In our example, the Clone field represents the `clone` command, so we need to create a file that holds this type. Let's go ahead and create the `clone.go` file inside the `cmd` directory and paste the following code inside: 141 | 142 | {{}} 143 | package cmd 144 | 145 | import ( 146 | "fmt" 147 | "log" 148 | 149 | "github.com/alecthomas/repr" 150 | ) 151 | 152 | type Clone struct { 153 | Repository, 154 | Directory string 155 | Verbose, 156 | Quiet, 157 | Progress, 158 | NoCheckout, 159 | Bare, 160 | Mirror, 161 | Local, 162 | NoHardlinks, 163 | Shared bool 164 | RecurseSubmodules string 165 | Jobs int 166 | Template, 167 | Reference, 168 | ReferenceIfAble string 169 | Dissociate bool 170 | Origin, 171 | Branch, 172 | UploadPack string 173 | Depth int 174 | ShallowSince, 175 | ShallowExclude string 176 | SingleBranch, 177 | NoTags, 178 | ShallowSubmodules bool 179 | SeparateGitDir, 180 | Config string 181 | Ipv4, 182 | Ipv6 bool 183 | Filter string 184 | } 185 | 186 | func (c *Clone) Doc() string { 187 | return `usage: git clone [] --repository= --directory= 188 | 189 | arguments: 190 | 191 | -r, --repository repository to clone 192 | -d, --directory path to directory 193 | -v, --verbose be more verbose 194 | -q, --quiet be more quiet 195 | --progress force progress reporting 196 | -n, --no-checkout don't create a checkout 197 | --bare create a bare repository 198 | --mirror create a mirror repository (implies bare) 199 | -l, --local to clone from a local repository 200 | --no-hardlinks don't use local hardlinks, always copy 201 | -s, --shared setup as shared repository 202 | --recurse-submodules= initialize submodules in the clone 203 | -j, --jobs= number of submodules cloned in parallel 204 | --template= directory from which templates will be used 205 | --reference= reference repository 206 | --reference-if-able= reference repository 207 | --dissociate use --reference only while cloning 208 | -o, --origin= use instead of 'origin' to track upstream 209 | -b, --branch= checkout instead of the remote's HEAD 210 | -u, --upload-pack= path to git-upload-pack on the remote 211 | --depth= create a shallow clone of that depth 212 | --shallow-since=}} 237 | 238 | In this tutorial, we won’t go into detail about the logic of the Clone command because its functionality is pretty straightforward. 239 | 240 | ### Writing the Methods’ Logic 241 | 242 | A specific method will run when a certain condition is met. 243 | 244 | #### **Error method** 245 | 246 | The Error method will run when the user passes an argument or command that is not registered in the docstring. Usually, you'll just print the error message to `stderr` and exit the program. In our example, we'll ignore invalid arguments and force the Run method to run, otherwise we'll print the error message to `stderr` and exit the program: 247 | 248 | {{}} 249 | func (g *Git) Error(err error) { 250 | switch err.(type) { 251 | case *args.InvalidArgumentError: 252 | // Ignore InvalidArgumentError. 253 | g.Run() 254 | default: 255 | log.Fatal(err) 256 | } 257 | } 258 | {{}} 259 | 260 | The `InvalidArgumentError` is within the `args` package, so make sure to add `"github.com/celicoo/docli/v2/args"` to 261 | the import declarations. 262 | 263 | #### **Help method** 264 | 265 | The Help method will run when the user passes the `help` argument. Usually, you'll just print the docstring to `stdout`; that’s what we’ll do in our example: 266 | 267 | {{}} 268 | func (g *Git) Help() { 269 | fmt.Println(g.Doc()) 270 | } 271 | {{}} 272 | 273 | #### **Run method** 274 | 275 | The Run method will run when no error is found and an argument other than `help` is called. In our example we'll print the version if the `--version` (or `-v`) command-line argument is passed, otherwise we'll just print "Hello, world!": 276 | 277 | {{}} 278 | func (g *Git) Run() { 279 | if g.Version { 280 | fmt.Println(version) 281 | return 282 | } 283 | fmt.Println("Hello, world!") 284 | } 285 | {{}} 286 | 287 | ### Initializing Docli 288 | 289 | We created a CLI app with one command and one argument. But if you try to execute it, it won’t run. There is one piece missing: initializing Docli. 290 | 291 | {{}} 292 | func Execute() { 293 | var g Git 294 | args := docli.Args() 295 | args.Bind(&g) 296 | } 297 | {{}} 298 | 299 | ### Testing the CLI app 300 | 301 | The very last step is to make sure it’s actually working. To do that, we need to build and run it: 302 | 303 | {{}} 304 | $ go build 305 | $ ./git 306 | 307 | Hello, world! 308 | {{}} 309 | 310 | Unlike other packages, Docli doesn't allow values to be assigned to arguments without using the `=` operator. You need to use the `=` operator, otherwise the internal parser will think you’re passing an argument and, as a result, the `Error` method of the struct that represents the command that you're executing will be called. The `clone` command was added to help you understand this, so go ahead and play with it. 311 | 312 | Congratulations! You’ve completed the tutorial. Thank you for reading, and I hope you enjoyed it. 313 | 314 | If you have any question, please don’t hesitate to [open an issue](https://github.com/celicoo/docli/issues). 315 | -------------------------------------------------------------------------------- /docs/content/docs/unsupported-features/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Unsupported features 3 | --- 4 | 5 | # Unsupported features 6 | 7 | Right now, Docli doesn't support the following features: 8 | 9 | * Bash autocomplete 10 | * Default values 11 | * Global arguments 12 | * Intelligent suggestions 13 | * Positional arguments 14 | 15 | If you need either one of those features, we recommend you to check out [awesome-go#standard-cli](https://github.com/avelino/awesome-go#standard-cli). 16 | -------------------------------------------------------------------------------- /docs/content/menu/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | headless: true 3 | --- 4 | 5 | - [Introduction]({{< relref "/" >}}) 6 | - [Installation]({{< relref "/docs/installation" >}}) 7 | - [Tutorial]({{< relref "/docs/tutorial" >}}) 8 | - [Unsupported features]({{< relref "/docs/unsupported-features" >}}) 9 | - [Examples](https://github.com/celicoo/docli/tree/main/examples) 10 | - [Feedback]({{< relref "/docs/feedback" >}}) 11 | - [License](https://github.com/celicoo/docli/blob/main/LICENSE) 12 | -------------------------------------------------------------------------------- /docs/layouts/partials/docs/brand.html: -------------------------------------------------------------------------------- 1 | 2 | {{ .Site.Title }} Logo 3 | 4 | -------------------------------------------------------------------------------- /docs/layouts/partials/docs/inject/head.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/layouts/partials/docs/inject/menu-after.html: -------------------------------------------------------------------------------- 1 | Star 2 | Watch 3 | -------------------------------------------------------------------------------- /docs/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 404 Page not found | Docli 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 30 | 34 | 35 | 36 | 37 | 47 | 48 | 49 | 50 |
51 |
52 |

404

53 |

Page Not Found

54 |

55 | Docli 56 |

57 |
58 |
59 | 60 | 61 | 62 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /docs/public/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/public/avatar.png -------------------------------------------------------------------------------- /docs/public/book.min.29d743ffb6d61ecbfc9bb21b7eab17d63b577d4bd547c3f095addb1c793ab1b1.css: -------------------------------------------------------------------------------- 1 | .markdown{line-height:1.7}.markdown>:first-child{margin-top:0;line-height:1em}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1.25}.markdown b,.markdown optgroup,.markdown strong{font-weight:700}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown code{font-family:oxygen mono,monospace}.markdown p code{padding:0 .25rem;background:#f8f9fa;border-radius:.15rem}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;font-size:.875rem;overflow-x:auto}.markdown blockquote{border-left:2px solid #dee2e6;margin:0;padding:1px 1rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table tr td{padding:.5rem}.flex{display:flex}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.mr-auto{margin-right:auto}.hide{display:none}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:25rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:oxygen,sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#004ed0}a:visited{color:#8440f1}img{vertical-align:middle}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center}ul.pagination .page-item a{padding:1rem}.container{min-width:25rem;max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-menu{flex:0 0 18rem;font-size:.875rem}.book-menu nav{width:18rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#004ed0}.book-page{min-width:25rem;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-toc{flex:0 0 14rem;font-size:.75rem}.book-toc nav{width:14rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc nav>ul>li{margin:0}.book-git-footer{display:flex;margin-top:1rem;font-size:.875rem;align-items:baseline}.book-git-footer img{width:.875rem;vertical-align:bottom}.book-posts{min-width:25rem;max-width:43rem;padding:1rem}.book-posts article{padding-bottom:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:57rem){.book-toc{display:none}}@media screen and (max-width:43rem){.book-menu{margin-left:-18rem}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(18rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-menu nav,.book-toc nav{padding:2rem 1rem}} -------------------------------------------------------------------------------- /docs/public/book.min.dd0f25ca71c9192648088113f8cdb8d63a2fbebc903768fb79ee24bc87357c98.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";:root{--gray-100:#f8f9fa;--gray-200:#e9ecef;--gray-500:#adb5bd;--color-link:#0055bb;--color-visited-link:#8440f1;--body-background:white;--body-font-color:black;--icon-filter:none;--hint-color-info:#6bf;--hint-color-warning:#fd6;--hint-color-danger:#f66}/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.hidden{display:none}input.toggle{height:0;width:0;overflow:hidden;opacity:0;position:absolute}.clearfix::after{content:"";display:table;clear:both}html{font-size:16px;scroll-behavior:smooth;touch-action:manipulation}body{min-width:20rem;color:var(--body-font-color);background:var(--body-background);letter-spacing:.33px;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:var(--color-link)}img{vertical-align:baseline}:focus{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0;position:relative}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-inline-start:1rem}ul.pagination{display:flex;justify-content:center;list-style-type:none}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-icon{filter:var(--icon-filter)}.book-brand{margin-top:0;margin-bottom:1rem}.book-brand img{height:1.5em;width:1.5em;margin-inline-end:.5rem}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu .book-menu-content{width:16rem;padding:1rem;background:var(--body-background);position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a,.book-menu label{color:inherit;cursor:pointer;word-wrap:break-word}.book-menu a.active{color:var(--color-link)}.book-menu input.toggle+label+ul{display:none}.book-menu input.toggle:checked+label+ul{display:block}.book-menu input.toggle+label::after{content:"▸"}.book-menu input.toggle:checked+label::after{content:"▾"}body[dir=rtl] .book-menu input.toggle+label::after{content:"◂"}body[dir=rtl] .book-menu input.toggle:checked+label::after{content:"▾"}.book-section-flat{margin:2rem 0}.book-section-flat>a,.book-section-flat>span,.book-section-flat>label{font-weight:bolder}.book-section-flat>ul{padding-inline-start:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-post{margin-bottom:3rem}.book-header{display:none;margin-bottom:1rem}.book-header label{line-height:0}.book-header img.book-icon{height:1.5em;width:1.5em}.book-search{position:relative;margin:1rem 0;border-bottom:1px solid transparent}.book-search input{width:100%;padding:.5rem;border:0;border-radius:.25rem;background:var(--gray-100);color:var(--body-font-color)}.book-search input:required+.book-search-spinner{display:block}.book-search .book-search-spinner{position:absolute;top:0;margin:.5rem;margin-inline-start:calc(100% - 1.5rem);width:1rem;height:1rem;border:1px solid transparent;border-top-color:var(--body-font-color);border-radius:50%;animation:spin 1s ease infinite}@keyframes spin{100%{transform:rotate(360deg)}}.book-search small{opacity:.5}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc .book-toc-content{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em;width:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-footer{padding-top:1rem;font-size:.875rem}.book-footer img{height:1em;width:1em;margin-inline-end:.5rem}.book-comments{margin-top:1rem}.book-languages{margin-block-end:2rem}.book-languages .book-icon{height:1em;width:1em;margin-inline-end:.5em}.book-languages ul{padding-inline-start:1.5em}.book-menu-content,.book-toc-content,.book-page,.book-header aside,.markdown{transition:.2s ease-in-out;transition-property:transform,margin,opacity,visibility;will-change:transform,margin,opacity}@media screen and (max-width:56rem){#menu-control,#toc-control{display:inline}.book-menu{visibility:hidden;margin-inline-start:-16rem;font-size:16px;z-index:1}.book-toc{display:none}.book-header{display:block}#menu-control:focus~main label[for=menu-control]{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}#menu-control:checked~main .book-menu{visibility:initial}#menu-control:checked~main .book-menu .book-menu-content{transform:translateX(16rem);box-shadow:0 0 .5rem rgba(0,0,0,.1)}#menu-control:checked~main .book-page{opacity:.25}#menu-control:checked~main .book-menu-overlay{display:block;position:absolute;top:0;bottom:0;left:0;right:0}#toc-control:focus~main label[for=toc-control]{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}#toc-control:checked~main .book-header aside{display:block}body[dir=rtl] #menu-control:checked~main .book-menu .book-menu-content{transform:translateX(-16rem)}}@media screen and (min-width:80rem){.book-page,.book-menu .book-menu-content,.book-toc .book-toc-content{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:normal;font-weight:400;font-display:swap;src:local(""),url(fonts/roboto-v27-latin-regular.woff2)format("woff2"),url(fonts/roboto-v27-latin-regular.woff)format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;font-display:swap;src:local(""),url(fonts/roboto-v27-latin-700.woff2)format("woff2"),url(fonts/roboto-v27-latin-700.woff)format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;font-display:swap;src:local(""),url(fonts/roboto-mono-v13-latin-regular.woff2)format("woff2"),url(fonts/roboto-mono-v13-latin-regular.woff)format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace}@media print{.book-menu,.book-footer,.book-toc{display:none}.book-header,.book-header aside{display:block}main{display:block!important}}.markdown{line-height:1.6}.markdown>:first-child{margin-top:0}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5,.markdown h6{font-weight:400;line-height:1;margin-top:1.5em;margin-bottom:1rem}.markdown h1 a.anchor,.markdown h2 a.anchor,.markdown h3 a.anchor,.markdown h4 a.anchor,.markdown h5 a.anchor,.markdown h6 a.anchor{opacity:0;font-size:.75em;vertical-align:middle;text-decoration:none}.markdown h1:hover a.anchor,.markdown h1 a.anchor:focus,.markdown h2:hover a.anchor,.markdown h2 a.anchor:focus,.markdown h3:hover a.anchor,.markdown h3 a.anchor:focus,.markdown h4:hover a.anchor,.markdown h4 a.anchor:focus,.markdown h5:hover a.anchor,.markdown h5 a.anchor:focus,.markdown h6:hover a.anchor,.markdown h6 a.anchor:focus{opacity:initial}.markdown h4,.markdown h5,.markdown h6{font-weight:bolder}.markdown h5{font-size:.875em}.markdown h6{font-size:.75em}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown a:visited{color:var(--color-visited-link)}.markdown img{max-width:100%;height:auto}.markdown code{padding:0 .25rem;background:var(--gray-200);border-radius:.25rem;font-size:.875em}.markdown pre{padding:1rem;background:var(--gray-100);border-radius:.25rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{margin:1rem 0;padding:.5rem 1rem .5rem .75rem;border-inline-start:.25rem solid var(--gray-200);border-radius:.25rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{overflow:auto;display:block;border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;border:1px solid var(--gray-200)}.markdown table tr:nth-child(2n){background:var(--gray-100)}.markdown hr{height:1px;border:none;background:var(--gray-200)}.markdown ul,.markdown ol{padding-inline-start:2rem}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-inline-start:0;margin-bottom:1rem}.markdown .highlight table tr td:nth-child(1) pre{margin:0;padding-inline-end:0}.markdown .highlight table tr td:nth-child(2) pre{margin:0;padding-inline-start:0}.markdown details{padding:1rem;border:1px solid var(--gray-200);border-radius:.25rem}.markdown details summary{line-height:1;padding:1rem;margin:-1rem;cursor:pointer}.markdown details[open] summary{margin-bottom:0}.markdown figure{margin:1rem 0}.markdown figure figcaption p{margin-top:0}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.markdown .book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid var(--gray-200);border-radius:.25rem;overflow:hidden}.markdown .book-expand .book-expand-head{background:var(--gray-100);padding:.5rem 1rem;cursor:pointer}.markdown .book-expand .book-expand-content{display:none;padding:1rem}.markdown .book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.markdown .book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid var(--gray-200);border-radius:.25rem;overflow:hidden;display:flex;flex-wrap:wrap}.markdown .book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.markdown .book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid var(--gray-100);padding:1rem;display:none}.markdown .book-tabs input[type=radio]:checked+label{border-bottom:1px solid var(--color-link)}.markdown .book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.markdown .book-tabs input[type=radio]:focus+label{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}.markdown .book-columns{margin-left:-1rem;margin-right:-1rem}.markdown .book-columns>div{margin:1rem 0;min-width:10rem;padding:0 1rem}.markdown a.book-btn{display:inline-block;font-size:.875rem;color:var(--color-link);line-height:2rem;padding:0 1rem;border:1px solid var(--color-link);border-radius:.25rem;cursor:pointer}.markdown a.book-btn:hover{text-decoration:none}.markdown .book-hint.info{border-color:#6bf;background-color:rgba(102,187,255,.1)}.markdown .book-hint.warning{border-color:#fd6;background-color:rgba(255,221,102,.1)}.markdown .book-hint.danger{border-color:#f66;background-color:rgba(255,102,102,.1)}main,aside nav{padding-top:60px!important} -------------------------------------------------------------------------------- /docs/public/docs/feedback/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Feedback | Docli 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
42 | 100 | 101 |
102 |
103 | 104 |
105 | 108 | 109 | Feedback 110 | 111 | 116 |
117 | 118 | 119 | 120 | 128 | 129 | 130 |
131 | 132 | 133 | 134 |

135 | Feedback 136 | # 137 |

138 |

Feel free to send me feedback on Twitter or file an issue. Feature requests and contributions are always welcome.

139 |
140 | 141 | 142 | 143 |
144 | 145 |
146 | 147 | 148 | 153 | 154 | 155 | 156 | 162 | 163 | 164 |
165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 |
174 | 175 | 176 | 177 |
178 | 179 |
180 | 181 | 182 | 183 | 184 |
185 | 186 | 187 | 197 | 198 |
199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /docs/public/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Docs | Docli 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 29 | 30 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 99 | 100 |
101 |
102 | 103 |
104 | 107 | 108 | Docs 109 | 110 | 115 |
116 | 117 | 118 | 119 | 127 | 128 | 129 |
130 | 131 | 132 | 133 |
134 | 135 | 136 | 137 |
138 | 139 |
140 | 141 | 142 | 143 | 144 | 145 |
146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 |
155 | 156 | 157 | 158 | 159 | 160 | 161 |
162 | 163 | 164 | 174 | 175 |
176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /docs/public/docs/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Docs on Docli 5 | https://docli.dev/docs/ 6 | Recent content in Docs on Docli 7 | Hugo -- gohugo.io 8 | en-us 9 | 10 | Feedback 11 | https://docli.dev/docs/feedback/ 12 | Mon, 01 Jan 0001 00:00:00 +0000 13 | 14 | https://docli.dev/docs/feedback/ 15 | Feedback # Feel free to send me feedback on Twitter or file an issue. Feature requests and contributions are always welcome. 16 | 17 | 18 | 19 | Installation 20 | https://docli.dev/docs/installation/ 21 | Mon, 01 Jan 0001 00:00:00 +0000 22 | 23 | https://docli.dev/docs/installation/ 24 | Installation # You can install Docli with a single command using go get, the Go package manager. Type this into your terminal: 25 | $ go get -u github.com/celicoo/docli/v2@latest Don&rsquo;t have Go installed? Learn how to install Go here. 26 | 27 | 28 | 29 | Tutorial 30 | https://docli.dev/docs/tutorial/ 31 | Mon, 01 Jan 0001 00:00:00 +0000 32 | 33 | https://docli.dev/docs/tutorial/ 34 | Tutorial # Welcome to the Docli Tutorial! Here you&rsquo;ll be introduced to the key Docli concepts. If you get stuck at any point in the process, feel free to download a working example of the completed CLI app. 35 | Confirming that Docli is installed # Before starting the tutorial, let&rsquo;s make sure that you have Docli installed. Go ahead and create a main.go file and paste the following content inside: 36 | 37 | 38 | 39 | Unsupported features 40 | https://docli.dev/docs/unsupported-features/ 41 | Mon, 01 Jan 0001 00:00:00 +0000 42 | 43 | https://docli.dev/docs/unsupported-features/ 44 | Unsupported features # Right now, Docli doesn&rsquo;t support the following features: 45 | Bash autocomplete Default values Global arguments Intelligent suggestions Positional arguments If you need either one of those features, we recommend you to check out awesome-go#standard-cli. 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/public/docs/installation/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | Installation | Docli 17 | 18 | 19 | 20 | 21 | 22 | 23 | 32 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 | 102 | 103 |
104 |
105 | 106 |
107 | 110 | 111 | Installation 112 | 113 | 118 |
119 | 120 | 121 | 122 | 130 | 131 | 132 |
133 | 134 | 135 | 136 |

137 | Installation 138 | # 139 |

140 |

You can install Docli with a single command using go get, the Go package manager. Type this into your terminal:

141 |
$ go get -u github.com/celicoo/docli/v2@latest
142 |

Don’t have Go installed? Learn how to install Go here.

143 |
144 | 145 | 146 | 147 |
148 | 149 |
150 | 151 | 152 | 157 | 158 | 159 | 160 | 166 | 167 | 168 |
169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 |
178 | 179 | 180 | 181 |
182 | 183 |
184 | 185 | 186 | 187 | 188 |
189 | 190 | 191 | 201 | 202 |
203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | -------------------------------------------------------------------------------- /docs/public/docs/license/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 11 | 12 | 13 | 14 | License | Docli 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
42 | 100 | 101 |
102 |
103 | 104 |
105 | 108 | 109 | License 110 | 111 | 116 |
117 | 118 | 119 | 120 | 128 | 129 | 130 |
131 | 132 | 133 | 134 |

135 | MIT License 136 | # 137 |

138 |

Copyright (c) 2018

139 |

Permission is hereby granted, free of charge, to any person obtaining a copy 140 | of this software and associated documentation files (the “Software”), to deal 141 | in the Software without restriction, including without limitation the rights 142 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 143 | copies of the Software, and to permit persons to whom the Software is 144 | furnished to do so, subject to the following conditions:

145 |

The above copyright notice and this permission notice shall be included in all 146 | copies or substantial portions of the Software.

147 |

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 148 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 149 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 150 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 151 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 152 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 153 | SOFTWARE.

154 |
155 | 156 | 157 | 158 |
159 | 160 |
161 | 162 | 163 | 168 | 169 | 170 | 171 | 177 | 178 | 179 |
180 | 181 | 182 | 183 | 185 | 186 | 187 | 188 | 189 |
190 | 191 | 192 | 193 |
194 | 195 |
196 | 197 | 198 | 199 | 200 |
201 | 202 | 203 | 213 | 214 |
215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | -------------------------------------------------------------------------------- /docs/public/docs/unsupported-features/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | Unsupported features | Docli 17 | 18 | 19 | 20 | 21 | 22 | 23 | 32 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 | 102 | 103 |
104 |
105 | 106 |
107 | 110 | 111 | Unsupported features 112 | 113 | 118 |
119 | 120 | 121 | 122 | 130 | 131 | 132 |
133 | 134 | 135 | 136 |

137 | Unsupported features 138 | # 139 |

140 |

Right now, Docli doesn’t support the following features:

141 |
    142 |
  • Bash autocomplete
  • 143 |
  • Default values
  • 144 |
  • Global arguments
  • 145 |
  • Intelligent suggestions
  • 146 |
  • Positional arguments
  • 147 |
148 |

If you need either one of those features, we recommend you to check out awesome-go#standard-cli.

149 |
150 | 151 | 152 | 153 |
154 | 155 |
156 | 157 | 158 | 163 | 164 | 165 | 166 | 172 | 173 | 174 |
175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 |
184 | 185 | 186 | 187 |
188 | 189 |
190 | 191 | 192 | 193 | 194 |
195 | 196 | 197 | 207 | 208 |
209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | -------------------------------------------------------------------------------- /docs/public/en.search-data.min.2e4816fcf335f19843d3e87d03c3ffbb98d6cc8dac625000b49e5493642d1265.json: -------------------------------------------------------------------------------- 1 | [{"id":0,"href":"/docs/feedback/","title":"Feedback","section":"Docs","content":"Feedback # Feel free to send me feedback on Twitter or file an issue. Feature requests and contributions are always welcome.\n"},{"id":1,"href":"/docs/installation/","title":"Installation","section":"Docs","content":"Installation # You can install Docli with a single command using go get, the Go package manager. Type this into your terminal:\n$ go get -u github.com/celicoo/docli/v2@latest Don\u0026rsquo;t have Go installed? Learn how to install Go here.\n"},{"id":2,"href":"/docs/license/","title":"License","section":"Docs","content":"MIT License # Copyright (c) 2018\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u0026ldquo;Software\u0026rdquo;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \u0026ldquo;AS IS\u0026rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"},{"id":3,"href":"/docs/tutorial/","title":"Tutorial","section":"Docs","content":"Tutorial # Welcome to the Docli Tutorial! Here you\u0026rsquo;ll be introduced to the key Docli concepts. If you get stuck at any point in the process, feel free to download a working example of the completed CLI app.\nConfirming that Docli is installed # Before starting the tutorial, let\u0026rsquo;s make sure that you have Docli installed. Go ahead and create a main.go file and paste the following content inside:\npackage main import ( \u0026#34;github.com/alecthomas/repr\u0026#34; \u0026#34;github.com/celicoo/docli\u0026#34; ) func main() { args := docli.Args() repr.Println(args) } Now build and run it:\n$ go build $ ./main docli.args{ } Note: the output is the Abstract Syntax Structure of the command-line arguments, and it\u0026rsquo;s empty because you didn\u0026rsquo;t pass any arguments. If you run it again passing arguments you should see a different output.\nCreating a new CLI app # Directory structure # If you like Cobra, you\u0026rsquo;ll feel at home with this. While you\u0026rsquo;re welcome to provide your own organization, typically a Docli-based app will follow the following directory structure:\n▾ app/ ▾ cmd/ root.go main.go Go ahead and create the above structure, but instead of app, let\u0026rsquo;s name the root directory to git.\napp/ # This is the root of our app. The main.go file goes into this directory and it\u0026rsquo;s responsible for calling the function that initializes Docli:\npackage main import \u0026#34;\u0026lt;path\u0026gt;/git\u0026#34; func main() { cmd.Execute() } Note: Make sure to replace the \u0026lt;path\u0026gt; placeholder.\ncmd/ # This is where the commands are stored. The root.go is responsible for the logic of the root command and the Execute() function:\npackage cmd const version = \u0026#34;0.0.1\u0026#34; type Git struct {} func (g *Git) Doc() string { return \u0026#34;\u0026#34; } func (g *Git) Run() { } func (g *Git) Help() { } func (g *Git) Error(err error) { } func Execute() { } The Git struct represents the root command in our CLI app and it must implement the docli.command interface.\nWriting the docstring # Like YAML or Python, the docstring is a line-oriented language that uses indentation to define structure. Lines beginning with either spaces or tabs are used to register arguments and commands (commands are explained a little later in the tutorial). These arguments and commands can have letters of any language, numbers, and dashes.\nLet’s go back to the root.go file and replace the Doc() method of our Git struct with:\nfunc (g *Git) Doc() string { return `usage: git \u0026lt;command\u0026gt; commands: c, clone clone a repository into a new directory arguments: v, --version print version Use \u0026#34;git \u0026lt;command\u0026gt; help\u0026#34; for more information about the \u0026lt;command\u0026gt;.` } By convention, dashes are used in front of arguments, but not commands. You can use this convention with Docli, but it\u0026rsquo;s not necessary.\nAccessing command-line argument values # Now that we’ve registered the arguments and commands in the docstring, we’ll need to define them as fields in the Git struct, so we can access their values. Fields that represent arguments will be primitive types and those that represent commands will be user-defined types that implement the docli.command interface, just like the root command does.\nRegardless of how many aliases your arguments or commands have , you\u0026rsquo;ll only need to (and only should) define one field in the struct. We suggest using the longer identifier, but you can use whichever you’d like.\nIn our example, we have one command and one argument, and each has two identifiers. Let’s add these to our Git struct:\ntype Git struct { Clone Clone Version bool } For every command, you’ll need to create a file to hold the type that represents the command. In our example, the Clone field represents the clone command, so we need to create a file that holds this type. Let\u0026rsquo;s go ahead and create the clone.go file inside the cmd directory and paste the following code inside:\npackage cmd import ( \u0026#34;fmt\u0026#34; \u0026#34;log\u0026#34; \u0026#34;github.com/alecthomas/repr\u0026#34; ) type Clone struct { Repository, Directory string Verbose, Quiet, Progress, NoCheckout, Bare, Mirror, Local, NoHardlinks, Shared bool RecurseSubmodules string Jobs int Template, Reference, ReferenceIfAble string Dissociate bool Origin, Branch, UploadPack string Depth int ShallowSince, ShallowExclude string SingleBranch, NoTags, ShallowSubmodules bool SeparateGitDir, Config string Ipv4, Ipv6 bool Filter string } func (c *Clone) Doc() string { return `usage: git clone [\u0026lt;arguments\u0026gt;] --repository=\u0026lt;url\u0026gt; --directory=\u0026lt;directory\u0026gt; arguments: -r, --repository repository to clone -d, --directory path to directory -v, --verbose be more verbose -q, --quiet be more quiet --progress force progress reporting -n, --no-checkout don\u0026#39;t create a checkout --bare create a bare repository --mirror create a mirror repository (implies bare) -l, --local to clone from a local repository --no-hardlinks don\u0026#39;t use local hardlinks, always copy -s, --shared setup as shared repository --recurse-submodules=\u0026lt;pathspec\u0026gt; initialize submodules in the clone -j, --jobs=\u0026lt;n\u0026gt; number of submodules cloned in parallel --template=\u0026lt;template-directory\u0026gt; directory from which templates will be used --reference=\u0026lt;repo\u0026gt; reference repository --reference-if-able=\u0026lt;repo\u0026gt; reference repository --dissociate use --reference only while cloning -o, --origin=\u0026lt;name\u0026gt; use \u0026lt;name\u0026gt; instead of \u0026#39;origin\u0026#39; to track upstream -b, --branch=\u0026lt;branch\u0026gt; checkout \u0026lt;branch\u0026gt; instead of the remote\u0026#39;s HEAD -u, --upload-pack=\u0026lt;path\u0026gt; path to git-upload-pack on the remote --depth=\u0026lt;depth\u0026gt; create a shallow clone of that depth --shallow-since=\u0026lt;time\u0026gt; create a shallow clone since a specific time --shallow-exclude=\u0026lt;revision\u0026gt; deepen history of shallow clone, excluding rev --single-branch clone only one branch, HEAD or --branch --no-tags don\u0026#39;t clone any tags, and make later fetches not to follow them --shallow-submodules any cloned submodules will be shallow --separate-git-dir=\u0026lt;gitdir\u0026gt; separate git dir from working tree -c, --config=\u0026lt;key=value\u0026gt; set config inside the new repository -4, --ipv4 use IPv4 addresses only -6, --ipv6 use IPv6 addresses only --filter=\u0026lt;args\u0026gt; object filtering ` } func (c *Clone) Run() { repr.Println(c) } func (c *Clone) Help() { fmt.Println(c.Doc()) } func (c *Clone) Error(err error) { log.Fatal(err) } In this tutorial, we won’t go into detail about the logic of the Clone command because its functionality is pretty straightforward.\nWriting the Methods’ Logic # A specific method will run when a certain condition is met.\nError method # The Error method will run when the user passes an argument or command that is not registered in the docstring. Usually, you\u0026rsquo;ll just print the error message to stderr and exit the program. In our example, we\u0026rsquo;ll ignore invalid arguments and force the Run method to run, otherwise we\u0026rsquo;ll print the error message to stderr and exit the program:\nfunc (g *Git) Error(err error) { switch err.(type) { case *args.InvalidArgumentError: // Ignore InvalidArgumentError. \tg.Run() default: log.Fatal(err) } } The InvalidArgumentError is within the args package, so make sure to add \u0026quot;github.com/celicoo/docli/args\u0026quot; to the import declarations.\nHelp method # The Help method will run when the user passes the help argument. Usually, you\u0026rsquo;ll just print the docstring to stdout; that’s what we’ll do in our example:\nfunc (g *Git) Help() { fmt.Println(g.Doc()) } Run method # The Run method will run when no error is found and an argument other than help is called. In our example we\u0026rsquo;ll print the version if the --version (or -v) command-line argument is passed, otherwise we\u0026rsquo;ll just print \u0026ldquo;Hello, world!\u0026quot;:\nfunc (g *Git) Run() { if g.Version { fmt.Println(version) return } fmt.Println(\u0026#34;Hello, world!\u0026#34;) } Initializing Docli # We created a CLI app with one command and one argument. But if you try to execute it, it won’t run. There is one piece missing: initializing Docli.\nfunc Execute() { var g Git args := docli.Args() args.Bind(\u0026amp;g) } Testing the CLI app # The very last step is to make sure it’s actually working. To do that, we need to build and run it:\n$ go build $ ./git Hello, world! Unlike other packages, Docli doesn\u0026rsquo;t allow values to be assigned to arguments without using the = operator. You need to use the = operator, otherwise the internal parser will think you’re passing an argument and, as a result, the Error method of the struct that represents the command that you\u0026rsquo;re executing will be called. The clone command was added to help you understand this, so go ahead and play with it.\nCongratulations! You’ve completed the tutorial. Thank you for reading, and I hope you enjoyed it.\nIf you have any question, please don’t hesitate to open an issue.\n"},{"id":4,"href":"/docs/unsupported-features/","title":"Unsupported features","section":"Docs","content":"Unsupported features # Right now, Docli doesn\u0026rsquo;t support the following features:\n Bash autocomplete Default values Global arguments Intelligent suggestions Positional arguments If you absolutely need either one of those features, we recommend these alternative libraries.\n"}] -------------------------------------------------------------------------------- /docs/public/en.search-data.min.b7c721dd1bec1696af0abc4157baf0d185c534cdcc71d9a1ce52329b7ec6da43.json: -------------------------------------------------------------------------------- 1 | [{"id":0,"href":"/docs/feedback/","title":"Feedback","section":"Docs","content":"Feedback # Feel free to send me feedback on Twitter or file an issue. Feature requests and contributions are always welcome.\n"},{"id":1,"href":"/docs/installation/","title":"Installation","section":"Docs","content":"Installation # You can install Docli with a single command using go get, the Go package manager. Type this into your terminal:\n$ go get -u github.com/celicoo/docli/v2@latest Don\u0026rsquo;t have Go installed? Learn how to install Go here.\n"},{"id":2,"href":"/docs/tutorial/","title":"Tutorial","section":"Docs","content":"Tutorial # Welcome to the Docli Tutorial! Here you\u0026rsquo;ll be introduced to the key Docli concepts. If you get stuck at any point in the process, feel free to download a working example of the completed CLI app.\nConfirming that Docli is installed # Before starting the tutorial, let\u0026rsquo;s make sure that you have Docli installed. Go ahead and create a main.go file and paste the following content inside:\npackage main import ( \u0026#34;github.com/alecthomas/repr\u0026#34; \u0026#34;github.com/celicoo/docli/v2\u0026#34; ) func main() { args := docli.Args() repr.Println(args) } Now build and run it:\n$ go build $ ./main docli.args{ } Note: the output is the Abstract Syntax Structure of the command-line arguments, and it\u0026rsquo;s empty because you didn\u0026rsquo;t pass any arguments. If you run it again passing arguments you should see a different output.\nCreating a new CLI app # Directory structure # If you like Cobra, you\u0026rsquo;ll feel at home with this. While you\u0026rsquo;re welcome to provide your own organization, typically a Docli-based app will follow the following directory structure:\n▾ app/ ▾ cmd/ root.go main.go Go ahead and create the above structure, but instead of app, let\u0026rsquo;s name the root directory to git.\napp/ # This is the root of our app. The main.go file goes into this directory and it\u0026rsquo;s responsible for calling the function that initializes Docli:\npackage main import \u0026#34;\u0026lt;path\u0026gt;/git\u0026#34; func main() { cmd.Execute() } Note: Make sure to replace the \u0026lt;path\u0026gt; placeholder.\ncmd/ # This is where the commands are stored. The root.go is responsible for the logic of the root command and the Execute() function:\npackage cmd const version = \u0026#34;0.0.1\u0026#34; type Git struct {} func (g *Git) Doc() string { return \u0026#34;\u0026#34; } func (g *Git) Run() { } func (g *Git) Help() { } func (g *Git) Error(err error) { } func Execute() { } The Git struct represents the root command in our CLI app and it must implement the docli.command interface.\nWriting the docstring # Like YAML or Python, the docstring is a line-oriented language that uses indentation to define structure. Lines beginning with either spaces or tabs are used to register arguments and commands (commands are explained a little later in the tutorial). These arguments and commands can have letters of any language, numbers, and dashes.\nLet’s go back to the root.go file and replace the Doc() method of our Git struct with:\nfunc (g *Git) Doc() string { return `usage: git \u0026lt;command\u0026gt; commands: c, clone clone a repository into a new directory arguments: v, --version print version Use \u0026#34;git \u0026lt;command\u0026gt; help\u0026#34; for more information about the \u0026lt;command\u0026gt;.` } By convention, dashes are used in front of arguments, but not commands. You can use this convention with Docli, but it\u0026rsquo;s not necessary.\nAccessing command-line argument values # Now that we’ve registered the arguments and commands in the docstring, we’ll need to define them as fields in the Git struct, so we can access their values. Fields that represent arguments will be primitive types and those that represent commands will be user-defined types that implement the docli.command interface, just like the root command does.\nRegardless of how many aliases your arguments or commands have , you\u0026rsquo;ll only need to (and only should) define one field in the struct. We suggest using the longer identifier, but you can use whichever you’d like.\nIn our example, we have one command and one argument, and each has two identifiers. Let’s add these to our Git struct:\ntype Git struct { Clone Clone Version bool } For every command, you’ll need to create a file to hold the type that represents the command. In our example, the Clone field represents the clone command, so we need to create a file that holds this type. Let\u0026rsquo;s go ahead and create the clone.go file inside the cmd directory and paste the following code inside:\npackage cmd import ( \u0026#34;fmt\u0026#34; \u0026#34;log\u0026#34; \u0026#34;github.com/alecthomas/repr\u0026#34; ) type Clone struct { Repository, Directory string Verbose, Quiet, Progress, NoCheckout, Bare, Mirror, Local, NoHardlinks, Shared bool RecurseSubmodules string Jobs int Template, Reference, ReferenceIfAble string Dissociate bool Origin, Branch, UploadPack string Depth int ShallowSince, ShallowExclude string SingleBranch, NoTags, ShallowSubmodules bool SeparateGitDir, Config string Ipv4, Ipv6 bool Filter string } func (c *Clone) Doc() string { return `usage: git clone [\u0026lt;arguments\u0026gt;] --repository=\u0026lt;url\u0026gt; --directory=\u0026lt;directory\u0026gt; arguments: -r, --repository repository to clone -d, --directory path to directory -v, --verbose be more verbose -q, --quiet be more quiet --progress force progress reporting -n, --no-checkout don\u0026#39;t create a checkout --bare create a bare repository --mirror create a mirror repository (implies bare) -l, --local to clone from a local repository --no-hardlinks don\u0026#39;t use local hardlinks, always copy -s, --shared setup as shared repository --recurse-submodules=\u0026lt;pathspec\u0026gt; initialize submodules in the clone -j, --jobs=\u0026lt;n\u0026gt; number of submodules cloned in parallel --template=\u0026lt;template-directory\u0026gt; directory from which templates will be used --reference=\u0026lt;repo\u0026gt; reference repository --reference-if-able=\u0026lt;repo\u0026gt; reference repository --dissociate use --reference only while cloning -o, --origin=\u0026lt;name\u0026gt; use \u0026lt;name\u0026gt; instead of \u0026#39;origin\u0026#39; to track upstream -b, --branch=\u0026lt;branch\u0026gt; checkout \u0026lt;branch\u0026gt; instead of the remote\u0026#39;s HEAD -u, --upload-pack=\u0026lt;path\u0026gt; path to git-upload-pack on the remote --depth=\u0026lt;depth\u0026gt; create a shallow clone of that depth --shallow-since=\u0026lt;time\u0026gt; create a shallow clone since a specific time --shallow-exclude=\u0026lt;revision\u0026gt; deepen history of shallow clone, excluding rev --single-branch clone only one branch, HEAD or --branch --no-tags don\u0026#39;t clone any tags, and make later fetches not to follow them --shallow-submodules any cloned submodules will be shallow --separate-git-dir=\u0026lt;gitdir\u0026gt; separate git dir from working tree -c, --config=\u0026lt;key=value\u0026gt; set config inside the new repository -4, --ipv4 use IPv4 addresses only -6, --ipv6 use IPv6 addresses only --filter=\u0026lt;args\u0026gt; object filtering ` } func (c *Clone) Run() { repr.Println(c) } func (c *Clone) Help() { fmt.Println(c.Doc()) } func (c *Clone) Error(err error) { log.Fatal(err) } In this tutorial, we won’t go into detail about the logic of the Clone command because its functionality is pretty straightforward.\nWriting the Methods’ Logic # A specific method will run when a certain condition is met.\nError method # The Error method will run when the user passes an argument or command that is not registered in the docstring. Usually, you\u0026rsquo;ll just print the error message to stderr and exit the program. In our example, we\u0026rsquo;ll ignore invalid arguments and force the Run method to run, otherwise we\u0026rsquo;ll print the error message to stderr and exit the program:\nfunc (g *Git) Error(err error) { switch err.(type) { case *args.InvalidArgumentError: // Ignore InvalidArgumentError. \tg.Run() default: log.Fatal(err) } } The InvalidArgumentError is within the args package, so make sure to add \u0026quot;github.com/celicoo/docli/v2/args\u0026quot; to the import declarations.\nHelp method # The Help method will run when the user passes the help argument. Usually, you\u0026rsquo;ll just print the docstring to stdout; that’s what we’ll do in our example:\nfunc (g *Git) Help() { fmt.Println(g.Doc()) } Run method # The Run method will run when no error is found and an argument other than help is called. In our example we\u0026rsquo;ll print the version if the --version (or -v) command-line argument is passed, otherwise we\u0026rsquo;ll just print \u0026ldquo;Hello, world!\u0026quot;:\nfunc (g *Git) Run() { if g.Version { fmt.Println(version) return } fmt.Println(\u0026#34;Hello, world!\u0026#34;) } Initializing Docli # We created a CLI app with one command and one argument. But if you try to execute it, it won’t run. There is one piece missing: initializing Docli.\nfunc Execute() { var g Git args := docli.Args() args.Bind(\u0026amp;g) } Testing the CLI app # The very last step is to make sure it’s actually working. To do that, we need to build and run it:\n$ go build $ ./git Hello, world! Unlike other packages, Docli doesn\u0026rsquo;t allow values to be assigned to arguments without using the = operator. You need to use the = operator, otherwise the internal parser will think you’re passing an argument and, as a result, the Error method of the struct that represents the command that you\u0026rsquo;re executing will be called. The clone command was added to help you understand this, so go ahead and play with it.\nCongratulations! You’ve completed the tutorial. Thank you for reading, and I hope you enjoyed it.\nIf you have any question, please don’t hesitate to open an issue.\n"},{"id":3,"href":"/docs/unsupported-features/","title":"Unsupported features","section":"Docs","content":"Unsupported features # Right now, Docli doesn\u0026rsquo;t support the following features:\n Bash autocomplete Default values Global arguments Intelligent suggestions Positional arguments If you need either one of those features, we recommend you to check out awesome-go#standard-cli.\n"}] -------------------------------------------------------------------------------- /docs/public/en.search-data.min.e590e8c46a909cea153ae2ea57829c489ba98d785de4512d3fc3650c9ee2e0ad.json: -------------------------------------------------------------------------------- 1 | [{"id":0,"href":"/docs/feedback/","title":"Feedback","section":"Docs","content":"Feedback # Feel free to send me feedback on Twitter or file an issue. Feature requests and contributions are always welcome.\n"},{"id":1,"href":"/docs/installation/","title":"Installation","section":"Docs","content":"Installation # You can install Docli with a single command using go get, the Go package manager. Type this into your terminal:\n$ go get -u github.com/celicoo/docli/v2@latest Don\u0026rsquo;t have Go installed? Learn how to install Go here.\n"},{"id":2,"href":"/docs/tutorial/","title":"Tutorial","section":"Docs","content":"Tutorial # Welcome to the Docli Tutorial! Here you\u0026rsquo;ll be introduced to the key Docli concepts. If you get stuck at any point in the process, feel free to download a working example of the completed CLI app.\nConfirming that Docli is installed # Before starting the tutorial, let\u0026rsquo;s make sure that you have Docli installed. Go ahead and create a main.go file and paste the following content inside:\npackage main import ( \u0026#34;github.com/alecthomas/repr\u0026#34; \u0026#34;github.com/celicoo/docli\u0026#34; ) func main() { args := docli.Args() repr.Println(args) } Now build and run it:\n$ go build $ ./main docli.args{ } Note: the output is the Abstract Syntax Structure of the command-line arguments, and it\u0026rsquo;s empty because you didn\u0026rsquo;t pass any arguments. If you run it again passing arguments you should see a different output.\nCreating a new CLI app # Directory structure # If you like Cobra, you\u0026rsquo;ll feel at home with this. While you\u0026rsquo;re welcome to provide your own organization, typically a Docli-based app will follow the following directory structure:\n▾ app/ ▾ cmd/ root.go main.go Go ahead and create the above structure, but instead of app, let\u0026rsquo;s name the root directory to git.\napp/ # This is the root of our app. The main.go file goes into this directory and it\u0026rsquo;s responsible for calling the function that initializes Docli:\npackage main import \u0026#34;\u0026lt;path\u0026gt;/git\u0026#34; func main() { cmd.Execute() } Note: Make sure to replace the \u0026lt;path\u0026gt; placeholder.\ncmd/ # This is where the commands are stored. The root.go is responsible for the logic of the root command and the Execute() function:\npackage cmd const version = \u0026#34;0.0.1\u0026#34; type Git struct {} func (g *Git) Doc() string { return \u0026#34;\u0026#34; } func (g *Git) Run() { } func (g *Git) Help() { } func (g *Git) Error(err error) { } func Execute() { } The Git struct represents the root command in our CLI app and it must implement the docli.command interface.\nWriting the docstring # Like YAML or Python, the docstring is a line-oriented language that uses indentation to define structure. Lines beginning with either spaces or tabs are used to register arguments and commands (commands are explained a little later in the tutorial). These arguments and commands can have letters of any language, numbers, and dashes.\nLet’s go back to the root.go file and replace the Doc() method of our Git struct with:\nfunc (g *Git) Doc() string { return `usage: git \u0026lt;command\u0026gt; commands: c, clone clone a repository into a new directory arguments: v, --version print version Use \u0026#34;git \u0026lt;command\u0026gt; help\u0026#34; for more information about the \u0026lt;command\u0026gt;.` } By convention, dashes are used in front of arguments, but not commands. You can use this convention with Docli, but it\u0026rsquo;s not necessary.\nAccessing command-line argument values # Now that we’ve registered the arguments and commands in the docstring, we’ll need to define them as fields in the Git struct, so we can access their values. Fields that represent arguments will be primitive types and those that represent commands will be user-defined types that implement the docli.command interface, just like the root command does.\nRegardless of how many aliases your arguments or commands have , you\u0026rsquo;ll only need to (and only should) define one field in the struct. We suggest using the longer identifier, but you can use whichever you’d like.\nIn our example, we have one command and one argument, and each has two identifiers. Let’s add these to our Git struct:\ntype Git struct { Clone Clone Version bool } For every command, you’ll need to create a file to hold the type that represents the command. In our example, the Clone field represents the clone command, so we need to create a file that holds this type. Let\u0026rsquo;s go ahead and create the clone.go file inside the cmd directory and paste the following code inside:\npackage cmd import ( \u0026#34;fmt\u0026#34; \u0026#34;log\u0026#34; \u0026#34;github.com/alecthomas/repr\u0026#34; ) type Clone struct { Repository, Directory string Verbose, Quiet, Progress, NoCheckout, Bare, Mirror, Local, NoHardlinks, Shared bool RecurseSubmodules string Jobs int Template, Reference, ReferenceIfAble string Dissociate bool Origin, Branch, UploadPack string Depth int ShallowSince, ShallowExclude string SingleBranch, NoTags, ShallowSubmodules bool SeparateGitDir, Config string Ipv4, Ipv6 bool Filter string } func (c *Clone) Doc() string { return `usage: git clone [\u0026lt;arguments\u0026gt;] --repository=\u0026lt;url\u0026gt; --directory=\u0026lt;directory\u0026gt; arguments: -r, --repository repository to clone -d, --directory path to directory -v, --verbose be more verbose -q, --quiet be more quiet --progress force progress reporting -n, --no-checkout don\u0026#39;t create a checkout --bare create a bare repository --mirror create a mirror repository (implies bare) -l, --local to clone from a local repository --no-hardlinks don\u0026#39;t use local hardlinks, always copy -s, --shared setup as shared repository --recurse-submodules=\u0026lt;pathspec\u0026gt; initialize submodules in the clone -j, --jobs=\u0026lt;n\u0026gt; number of submodules cloned in parallel --template=\u0026lt;template-directory\u0026gt; directory from which templates will be used --reference=\u0026lt;repo\u0026gt; reference repository --reference-if-able=\u0026lt;repo\u0026gt; reference repository --dissociate use --reference only while cloning -o, --origin=\u0026lt;name\u0026gt; use \u0026lt;name\u0026gt; instead of \u0026#39;origin\u0026#39; to track upstream -b, --branch=\u0026lt;branch\u0026gt; checkout \u0026lt;branch\u0026gt; instead of the remote\u0026#39;s HEAD -u, --upload-pack=\u0026lt;path\u0026gt; path to git-upload-pack on the remote --depth=\u0026lt;depth\u0026gt; create a shallow clone of that depth --shallow-since=\u0026lt;time\u0026gt; create a shallow clone since a specific time --shallow-exclude=\u0026lt;revision\u0026gt; deepen history of shallow clone, excluding rev --single-branch clone only one branch, HEAD or --branch --no-tags don\u0026#39;t clone any tags, and make later fetches not to follow them --shallow-submodules any cloned submodules will be shallow --separate-git-dir=\u0026lt;gitdir\u0026gt; separate git dir from working tree -c, --config=\u0026lt;key=value\u0026gt; set config inside the new repository -4, --ipv4 use IPv4 addresses only -6, --ipv6 use IPv6 addresses only --filter=\u0026lt;args\u0026gt; object filtering ` } func (c *Clone) Run() { repr.Println(c) } func (c *Clone) Help() { fmt.Println(c.Doc()) } func (c *Clone) Error(err error) { log.Fatal(err) } In this tutorial, we won’t go into detail about the logic of the Clone command because its functionality is pretty straightforward.\nWriting the Methods’ Logic # A specific method will run when a certain condition is met.\nError method # The Error method will run when the user passes an argument or command that is not registered in the docstring. Usually, you\u0026rsquo;ll just print the error message to stderr and exit the program. In our example, we\u0026rsquo;ll ignore invalid arguments and force the Run method to run, otherwise we\u0026rsquo;ll print the error message to stderr and exit the program:\nfunc (g *Git) Error(err error) { switch err.(type) { case *args.InvalidArgumentError: // Ignore InvalidArgumentError. \tg.Run() default: log.Fatal(err) } } The InvalidArgumentError is within the args package, so make sure to add \u0026quot;github.com/celicoo/docli/args\u0026quot; to the import declarations.\nHelp method # The Help method will run when the user passes the help argument. Usually, you\u0026rsquo;ll just print the docstring to stdout; that’s what we’ll do in our example:\nfunc (g *Git) Help() { fmt.Println(g.Doc()) } Run method # The Run method will run when no error is found and an argument other than help is called. In our example we\u0026rsquo;ll print the version if the --version (or -v) command-line argument is passed, otherwise we\u0026rsquo;ll just print \u0026ldquo;Hello, world!\u0026quot;:\nfunc (g *Git) Run() { if g.Version { fmt.Println(version) return } fmt.Println(\u0026#34;Hello, world!\u0026#34;) } Initializing Docli # We created a CLI app with one command and one argument. But if you try to execute it, it won’t run. There is one piece missing: initializing Docli.\nfunc Execute() { var g Git args := docli.Args() args.Bind(\u0026amp;g) } Testing the CLI app # The very last step is to make sure it’s actually working. To do that, we need to build and run it:\n$ go build $ ./git Hello, world! Unlike other packages, Docli doesn\u0026rsquo;t allow values to be assigned to arguments without using the = operator. You need to use the = operator, otherwise the internal parser will think you’re passing an argument and, as a result, the Error method of the struct that represents the command that you\u0026rsquo;re executing will be called. The clone command was added to help you understand this, so go ahead and play with it.\nCongratulations! You’ve completed the tutorial. Thank you for reading, and I hope you enjoyed it.\nIf you have any question, please don’t hesitate to open an issue.\n"},{"id":3,"href":"/docs/unsupported-features/","title":"Unsupported features","section":"Docs","content":"Unsupported features # Right now, Docli doesn\u0026rsquo;t support the following features:\n Bash autocomplete Default values Global arguments Intelligent suggestions Positional arguments If you absolutely need either one of those features, we recommend these alternative libraries.\n"}] -------------------------------------------------------------------------------- /docs/public/en.search-data.min.eede715b4a6d62ae010148ceeaeb809fca5a0b0d743a280dd9c411fecf86d5dd.json: -------------------------------------------------------------------------------- 1 | [{"id":0,"href":"/docs/feedback/","title":"Feedback","section":"Docs","content":"Feedback # Feel free to send me feedback on Twitter or file an issue. Feature requests and contributions are always welcome.\n"},{"id":1,"href":"/docs/installation/","title":"Installation","section":"Docs","content":"Installation # You can install Docli with a single command using go get, the Go package manager. Type this into your terminal:\n$ go get -u github.com/celicoo/docli/v2@latest Don\u0026rsquo;t have Go installed? Learn how to install Go here.\n"},{"id":2,"href":"/docs/tutorial/","title":"Tutorial","section":"Docs","content":"Tutorial # Welcome to the Docli Tutorial! Here you\u0026rsquo;ll be introduced to the key Docli concepts. If you get stuck at any point in the process, feel free to download a working example of the completed CLI app.\nConfirming that Docli is installed # Before starting the tutorial, let\u0026rsquo;s make sure that you have Docli installed. Go ahead and create a main.go file and paste the following content inside:\npackage main import ( \u0026#34;github.com/alecthomas/repr\u0026#34; \u0026#34;github.com/celicoo/docli/v2\u0026#34; ) func main() { args := docli.Args() repr.Println(args) } Now build and run it:\n$ go build $ ./main docli.args{ } Note: the output is the Abstract Syntax Structure of the command-line arguments, and it\u0026rsquo;s empty because you didn\u0026rsquo;t pass any arguments. If you run it again passing arguments you should see a different output.\nCreating a new CLI app # Directory structure # If you like Cobra, you\u0026rsquo;ll feel at home with this. While you\u0026rsquo;re welcome to provide your own organization, typically a Docli-based app will follow the following directory structure:\n▾ app/ ▾ cmd/ root.go main.go Go ahead and create the above structure, but instead of app, let\u0026rsquo;s name the root directory to git.\napp/ # This is the root of our app. The main.go file goes into this directory and it\u0026rsquo;s responsible for calling the function that initializes Docli:\npackage main import \u0026#34;\u0026lt;path\u0026gt;/git\u0026#34; func main() { cmd.Execute() } Note: Make sure to replace the \u0026lt;path\u0026gt; placeholder.\ncmd/ # This is where the commands are stored. The root.go is responsible for the logic of the root command and the Execute() function:\npackage cmd const version = \u0026#34;0.0.1\u0026#34; type Git struct {} func (g *Git) Doc() string { return \u0026#34;\u0026#34; } func (g *Git) Run() { } func (g *Git) Help() { } func (g *Git) Error(err error) { } func Execute() { } The Git struct represents the root command in our CLI app and it must implement the docli.command interface.\nWriting the docstring # Like YAML or Python, the docstring is a line-oriented language that uses indentation to define structure. Lines beginning with either spaces or tabs are used to register arguments and commands (commands are explained a little later in the tutorial). These arguments and commands can have letters of any language, numbers, and dashes.\nLet’s go back to the root.go file and replace the Doc() method of our Git struct with:\nfunc (g *Git) Doc() string { return `usage: git \u0026lt;command\u0026gt; commands: c, clone clone a repository into a new directory arguments: v, --version print version Use \u0026#34;git \u0026lt;command\u0026gt; help\u0026#34; for more information about the \u0026lt;command\u0026gt;.` } By convention, dashes are used in front of arguments, but not commands. You can use this convention with Docli, but it\u0026rsquo;s not necessary.\nAccessing command-line argument values # Now that we’ve registered the arguments and commands in the docstring, we’ll need to define them as fields in the Git struct, so we can access their values. Fields that represent arguments will be primitive types and those that represent commands will be user-defined types that implement the docli.command interface, just like the root command does.\nRegardless of how many aliases your arguments or commands have , you\u0026rsquo;ll only need to (and only should) define one field in the struct. We suggest using the longer identifier, but you can use whichever you’d like.\nIn our example, we have one command and one argument, and each has two identifiers. Let’s add these to our Git struct:\ntype Git struct { Clone Clone Version bool } For every command, you’ll need to create a file to hold the type that represents the command. In our example, the Clone field represents the clone command, so we need to create a file that holds this type. Let\u0026rsquo;s go ahead and create the clone.go file inside the cmd directory and paste the following code inside:\npackage cmd import ( \u0026#34;fmt\u0026#34; \u0026#34;log\u0026#34; \u0026#34;github.com/alecthomas/repr\u0026#34; ) type Clone struct { Repository, Directory string Verbose, Quiet, Progress, NoCheckout, Bare, Mirror, Local, NoHardlinks, Shared bool RecurseSubmodules string Jobs int Template, Reference, ReferenceIfAble string Dissociate bool Origin, Branch, UploadPack string Depth int ShallowSince, ShallowExclude string SingleBranch, NoTags, ShallowSubmodules bool SeparateGitDir, Config string Ipv4, Ipv6 bool Filter string } func (c *Clone) Doc() string { return `usage: git clone [\u0026lt;arguments\u0026gt;] --repository=\u0026lt;url\u0026gt; --directory=\u0026lt;directory\u0026gt; arguments: -r, --repository repository to clone -d, --directory path to directory -v, --verbose be more verbose -q, --quiet be more quiet --progress force progress reporting -n, --no-checkout don\u0026#39;t create a checkout --bare create a bare repository --mirror create a mirror repository (implies bare) -l, --local to clone from a local repository --no-hardlinks don\u0026#39;t use local hardlinks, always copy -s, --shared setup as shared repository --recurse-submodules=\u0026lt;pathspec\u0026gt; initialize submodules in the clone -j, --jobs=\u0026lt;n\u0026gt; number of submodules cloned in parallel --template=\u0026lt;template-directory\u0026gt; directory from which templates will be used --reference=\u0026lt;repo\u0026gt; reference repository --reference-if-able=\u0026lt;repo\u0026gt; reference repository --dissociate use --reference only while cloning -o, --origin=\u0026lt;name\u0026gt; use \u0026lt;name\u0026gt; instead of \u0026#39;origin\u0026#39; to track upstream -b, --branch=\u0026lt;branch\u0026gt; checkout \u0026lt;branch\u0026gt; instead of the remote\u0026#39;s HEAD -u, --upload-pack=\u0026lt;path\u0026gt; path to git-upload-pack on the remote --depth=\u0026lt;depth\u0026gt; create a shallow clone of that depth --shallow-since=\u0026lt;time\u0026gt; create a shallow clone since a specific time --shallow-exclude=\u0026lt;revision\u0026gt; deepen history of shallow clone, excluding rev --single-branch clone only one branch, HEAD or --branch --no-tags don\u0026#39;t clone any tags, and make later fetches not to follow them --shallow-submodules any cloned submodules will be shallow --separate-git-dir=\u0026lt;gitdir\u0026gt; separate git dir from working tree -c, --config=\u0026lt;key=value\u0026gt; set config inside the new repository -4, --ipv4 use IPv4 addresses only -6, --ipv6 use IPv6 addresses only --filter=\u0026lt;args\u0026gt; object filtering ` } func (c *Clone) Run() { repr.Println(c) } func (c *Clone) Help() { fmt.Println(c.Doc()) } func (c *Clone) Error(err error) { log.Fatal(err) } In this tutorial, we won’t go into detail about the logic of the Clone command because its functionality is pretty straightforward.\nWriting the Methods’ Logic # A specific method will run when a certain condition is met.\nError method # The Error method will run when the user passes an argument or command that is not registered in the docstring. Usually, you\u0026rsquo;ll just print the error message to stderr and exit the program. In our example, we\u0026rsquo;ll ignore invalid arguments and force the Run method to run, otherwise we\u0026rsquo;ll print the error message to stderr and exit the program:\nfunc (g *Git) Error(err error) { switch err.(type) { case *args.InvalidArgumentError: // Ignore InvalidArgumentError. \tg.Run() default: log.Fatal(err) } } The InvalidArgumentError is within the args package, so make sure to add \u0026quot;github.com/celicoo/docli/v2/args\u0026quot; to the import declarations.\nHelp method # The Help method will run when the user passes the help argument. Usually, you\u0026rsquo;ll just print the docstring to stdout; that’s what we’ll do in our example:\nfunc (g *Git) Help() { fmt.Println(g.Doc()) } Run method # The Run method will run when no error is found and an argument other than help is called. In our example we\u0026rsquo;ll print the version if the --version (or -v) command-line argument is passed, otherwise we\u0026rsquo;ll just print \u0026ldquo;Hello, world!\u0026quot;:\nfunc (g *Git) Run() { if g.Version { fmt.Println(version) return } fmt.Println(\u0026#34;Hello, world!\u0026#34;) } Initializing Docli # We created a CLI app with one command and one argument. But if you try to execute it, it won’t run. There is one piece missing: initializing Docli.\nfunc Execute() { var g Git args := docli.Args() args.Bind(\u0026amp;g) } Testing the CLI app # The very last step is to make sure it’s actually working. To do that, we need to build and run it:\n$ go build $ ./git Hello, world! Unlike other packages, Docli doesn\u0026rsquo;t allow values to be assigned to arguments without using the = operator. You need to use the = operator, otherwise the internal parser will think you’re passing an argument and, as a result, the Error method of the struct that represents the command that you\u0026rsquo;re executing will be called. The clone command was added to help you understand this, so go ahead and play with it.\nCongratulations! You’ve completed the tutorial. Thank you for reading, and I hope you enjoyed it.\nIf you have any question, please don’t hesitate to open an issue.\n"},{"id":3,"href":"/docs/unsupported-features/","title":"Unsupported features","section":"Docs","content":"Unsupported features # Right now, Docli doesn\u0026rsquo;t support the following features:\n Bash autocomplete Default values Global arguments Intelligent suggestions Positional arguments If you absolutely need either one of those features, we recommend these alternative libraries.\n"}] -------------------------------------------------------------------------------- /docs/public/en.search.min.055211035e76540870f517153dc4d92a1bb55b5d44ef3c659de97821b47f221e.js: -------------------------------------------------------------------------------- 1 | 'use strict';(function(){const g='/en.search-data.min.e590e8c46a909cea153ae2ea57829c489ba98d785de4512d3fc3650c9ee2e0ad.json',h=Object.assign({cache:!0},{doc:{id:'id',field:['title','content'],store:['title','href','section']}}),a=document.querySelector('#book-search-input'),b=document.querySelector('#book-search-results');if(!a)return;a.addEventListener('focus',c),a.addEventListener('keyup',d),document.addEventListener('keypress',e);function e(b){if(a===document.activeElement)return;const c=String.fromCharCode(b.charCode);if(!f(c))return;a.focus(),b.preventDefault()}function f(b){const c=a.getAttribute('data-hotkeys')||'';return c.indexOf(b)>=0}function c(){a.removeEventListener('focus',c),a.required=!0,fetch(g).then(a=>a.json()).then(a=>{window.bookSearchIndex=FlexSearch.create('balance',h),window.bookSearchIndex.add(a)}).then(()=>a.required=!1).then(d)}function d(){while(b.firstChild)b.removeChild(b.firstChild);if(!a.value)return;const c=window.bookSearchIndex.search(a.value,10);c.forEach(function(a){const c=i('
  • '),d=c.querySelector('a'),e=c.querySelector('small');d.href=a.href,d.textContent=a.title,e.textContent=a.section,b.appendChild(c)})}function i(b){const a=document.createElement('div');return a.innerHTML=b,a.firstChild}})() -------------------------------------------------------------------------------- /docs/public/en.search.min.0cd04d6a90707e870433c7aac59a3f0ecde0f01ccd88395162b53d7d5d87535c.js: -------------------------------------------------------------------------------- 1 | 'use strict';(function(){const g='/en.search-data.min.eede715b4a6d62ae010148ceeaeb809fca5a0b0d743a280dd9c411fecf86d5dd.json',h=Object.assign({cache:!0},{doc:{id:'id',field:['title','content'],store:['title','href','section']}}),a=document.querySelector('#book-search-input'),b=document.querySelector('#book-search-results');if(!a)return;a.addEventListener('focus',c),a.addEventListener('keyup',d),document.addEventListener('keypress',e);function e(b){if(a===document.activeElement)return;const c=String.fromCharCode(b.charCode);if(!f(c))return;a.focus(),b.preventDefault()}function f(b){const c=a.getAttribute('data-hotkeys')||'';return c.indexOf(b)>=0}function c(){a.removeEventListener('focus',c),a.required=!0,fetch(g).then(a=>a.json()).then(a=>{window.bookSearchIndex=FlexSearch.create('balance',h),window.bookSearchIndex.add(a)}).then(()=>a.required=!1).then(d)}function d(){while(b.firstChild)b.removeChild(b.firstChild);if(!a.value)return;const c=window.bookSearchIndex.search(a.value,10);c.forEach(function(a){const c=i('
  • '),d=c.querySelector('a'),e=c.querySelector('small');d.href=a.href,d.textContent=a.title,e.textContent=a.section,b.appendChild(c)})}function i(b){const a=document.createElement('div');return a.innerHTML=b,a.firstChild}})() -------------------------------------------------------------------------------- /docs/public/en.search.min.551ad11ad4c428fd22af05a79645e08ed16760f970190c22749f37b3ff76b790.js: -------------------------------------------------------------------------------- 1 | 'use strict';(function(){const g='/en.search-data.min.b7c721dd1bec1696af0abc4157baf0d185c534cdcc71d9a1ce52329b7ec6da43.json',h=Object.assign({cache:!0},{doc:{id:'id',field:['title','content'],store:['title','href','section']}}),a=document.querySelector('#book-search-input'),b=document.querySelector('#book-search-results');if(!a)return;a.addEventListener('focus',c),a.addEventListener('keyup',d),document.addEventListener('keypress',e);function e(b){if(a===document.activeElement)return;const c=String.fromCharCode(b.charCode);if(!f(c))return;a.focus(),b.preventDefault()}function f(b){const c=a.getAttribute('data-hotkeys')||'';return c.indexOf(b)>=0}function c(){a.removeEventListener('focus',c),a.required=!0,fetch(g).then(a=>a.json()).then(a=>{window.bookSearchIndex=FlexSearch.create('balance',h),window.bookSearchIndex.add(a)}).then(()=>a.required=!1).then(d)}function d(){while(b.firstChild)b.removeChild(b.firstChild);if(!a.value)return;const c=window.bookSearchIndex.search(a.value,10);c.forEach(function(a){const c=i('
  • '),d=c.querySelector('a'),e=c.querySelector('small');d.href=a.href,d.textContent=a.title,e.textContent=a.section,b.appendChild(c)})}function i(b){const a=document.createElement('div');return a.innerHTML=b,a.firstChild}})() -------------------------------------------------------------------------------- /docs/public/en.search.min.ccd1416a9f4d5c223125235f4930c17094838c6bbc76296c7b6380ea70d0061f.js: -------------------------------------------------------------------------------- 1 | 'use strict';(function(){const searchDataURL='/en.search-data.min.2e4816fcf335f19843d3e87d03c3ffbb98d6cc8dac625000b49e5493642d1265.json';const indexConfig=Object.assign({cache:true},{doc:{id:'id',field:['title','content'],store:['title','href','section']}});const input=document.querySelector('#book-search-input');const results=document.querySelector('#book-search-results');if(!input){return} 2 | input.addEventListener('focus',init);input.addEventListener('keyup',search);document.addEventListener('keypress',focusSearchFieldOnKeyPress);function focusSearchFieldOnKeyPress(event){if(input===document.activeElement){return;} 3 | const characterPressed=String.fromCharCode(event.charCode);if(!isHotkey(characterPressed)){return;} 4 | input.focus();event.preventDefault();} 5 | function isHotkey(character){const dataHotkeys=input.getAttribute('data-hotkeys')||'';return dataHotkeys.indexOf(character)>=0;} 6 | function init(){input.removeEventListener('focus',init);input.required=true;fetch(searchDataURL).then(pages=>pages.json()).then(pages=>{window.bookSearchIndex=FlexSearch.create('balance',indexConfig);window.bookSearchIndex.add(pages);}).then(()=>input.required=false).then(search);} 7 | function search(){while(results.firstChild){results.removeChild(results.firstChild);} 8 | if(!input.value){return;} 9 | const searchHits=window.bookSearchIndex.search(input.value,10);searchHits.forEach(function(page){const li=element('
  • ');const a=li.querySelector('a'),small=li.querySelector('small');a.href=page.href;a.textContent=page.title;small.textContent=page.section;results.appendChild(li);});} 10 | function element(content){const div=document.createElement('div');div.innerHTML=content;return div.firstChild;}})(); -------------------------------------------------------------------------------- /docs/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/public/favicon.png -------------------------------------------------------------------------------- /docs/public/favicon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/public/fonts/roboto-mono-v13-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/public/fonts/roboto-mono-v13-latin-regular.woff -------------------------------------------------------------------------------- /docs/public/fonts/roboto-mono-v13-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/public/fonts/roboto-mono-v13-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/public/fonts/roboto-v27-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/public/fonts/roboto-v27-latin-700.woff -------------------------------------------------------------------------------- /docs/public/fonts/roboto-v27-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/public/fonts/roboto-v27-latin-700.woff2 -------------------------------------------------------------------------------- /docs/public/fonts/roboto-v27-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/public/fonts/roboto-v27-latin-regular.woff -------------------------------------------------------------------------------- /docs/public/fonts/roboto-v27-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/public/fonts/roboto-v27-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | Introduction | Docli 17 | 18 | 19 | 20 | 21 | 22 | 23 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
    45 | 103 | 104 |
    105 |
    106 | 107 |
    108 | 111 | 112 | Introduction 113 | 114 | 119 |
    120 | 121 | 122 | 123 | 136 | 137 | 138 |
    139 | 140 | 141 | 142 |

    143 | Introduction 144 | # 145 |

    146 |

    Build Status 147 | GoDoc

    148 |

    Welcome to the official Docli documentation. Here you’ll learn how to use Docli for your next project.

    149 |

    150 | What is Docli? 151 | # 152 |

    153 |

    Docli is a declarative language for describing command-line interfaces in Go programs. It cuts down the boilerplate to the bare minimum so you’re free to move on to the actual reason you’re making the app in the first place.

    154 |

    Docli is 100% inspired by docopt.

    155 |

    156 | Getting started 157 | # 158 |

    159 |

    The easiest way to get started with Docli is by following the Tutorial. To make the most out of it, you should have a working knowledge of:

    160 | 166 |

    Good luck.

    167 |
    168 | 169 | 170 | 171 |
    172 | 173 |
    174 | 175 | 176 | 181 | 182 | 183 | 184 | 190 | 191 | 192 |
    193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 |
    202 | 203 | 204 | 205 |
    206 | 207 |
    208 | 209 | 210 | 211 | 212 |
    213 | 214 | 215 | 230 | 231 |
    232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /docs/public/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Introduction on Docli 5 | https://docli.dev/ 6 | Recent content in Introduction on Docli 7 | Hugo -- gohugo.io 8 | en-us 9 | 10 | Feedback 11 | https://docli.dev/docs/feedback/ 12 | Mon, 01 Jan 0001 00:00:00 +0000 13 | 14 | https://docli.dev/docs/feedback/ 15 | Feedback # Feel free to send me feedback on Twitter or file an issue. Feature requests and contributions are always welcome. 16 | 17 | 18 | 19 | Installation 20 | https://docli.dev/docs/installation/ 21 | Mon, 01 Jan 0001 00:00:00 +0000 22 | 23 | https://docli.dev/docs/installation/ 24 | Installation # You can install Docli with a single command using go get, the Go package manager. Type this into your terminal: 25 | $ go get -u github.com/celicoo/docli/v2@latest Don&rsquo;t have Go installed? Learn how to install Go here. 26 | 27 | 28 | 29 | Tutorial 30 | https://docli.dev/docs/tutorial/ 31 | Mon, 01 Jan 0001 00:00:00 +0000 32 | 33 | https://docli.dev/docs/tutorial/ 34 | Tutorial # Welcome to the Docli Tutorial! Here you&rsquo;ll be introduced to the key Docli concepts. If you get stuck at any point in the process, feel free to download a working example of the completed CLI app. 35 | Confirming that Docli is installed # Before starting the tutorial, let&rsquo;s make sure that you have Docli installed. Go ahead and create a main.go file and paste the following content inside: 36 | 37 | 38 | 39 | Unsupported features 40 | https://docli.dev/docs/unsupported-features/ 41 | Mon, 01 Jan 0001 00:00:00 +0000 42 | 43 | https://docli.dev/docs/unsupported-features/ 44 | Unsupported features # Right now, Docli doesn&rsquo;t support the following features: 45 | Bash autocomplete Default values Global arguments Intelligent suggestions Positional arguments If you need either one of those features, we recommend you to check out awesome-go#standard-cli. 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/public/katex/auto-render.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=function(e,t,r){for(var n=r,o=0,a=e.length;n 2 | 4 | 5 | https://docli.dev/docs/ 6 | 2021-09-19T20:22:20-03:00 7 | 8 | https://docli.dev/docs/feedback/ 9 | 2019-06-25T13:48:52-03:00 10 | 11 | https://docli.dev/docs/installation/ 12 | 2021-09-13T19:36:46-03:00 13 | 14 | https://docli.dev/ 15 | 2021-09-14T14:06:30-03:00 16 | 17 | https://docli.dev/docs/tutorial/ 18 | 2021-09-14T13:45:28-03:00 19 | 20 | https://docli.dev/docs/unsupported-features/ 21 | 2021-09-19T20:22:20-03:00 22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/public/svg/calendar.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/public/svg/code-fork.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/public/svg/code-merge.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/public/svg/edit.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/public/svg/menu.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/public/svg/toc.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/public/svg/translate.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content: -------------------------------------------------------------------------------- 1 | /*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.markdown{line-height:1.6}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1;margin-top:1.5em;margin-bottom:1rem}.markdown>:first-child{margin-top:0}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown img{max-width:100%}.markdown code{padding:0 .25rem;background:#f8f9fa;border-radius:.15rem}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;font-size:.875em;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{border-left:2px solid #dee2e6;margin:1rem 0;padding:1px 1rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{border:1px solid #e9ecef;margin-top:1rem;margin-bottom:1rem}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{border:1px solid #e9ecef;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #004ed0}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns{margin-top:1rem;margin-bottom:1rem}.book-columns>div{max-width:50%}.book-columns>div+div{margin-left:2rem}a.book-btn{display:inline-block;color:#004ed0!important;text-decoration:none!important;border:1px solid #004ed0;border-radius:.25rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#004ed0}a:visited{color:#8440f1}img{vertical-align:middle}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#004ed0}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-toc{flex:0 0 14rem;font-size:.75rem}.book-toc nav{width:14rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc nav>ul>li:first-child{margin-top:0}.book-toc.level-1 ul ul,.book-toc.level-2 ul ul ul,.book-toc.level-3 ul ul ul ul,.book-toc.level-4 ul ul ul ul ul,.book-toc.level-5 ul ul ul ul ul ul,.book-toc.level-6 ul ul ul ul ul ul ul{display:none}.book-footer{display:flex;padding-top:1rem;font-size:.875rem;align-items:baseline}.book-footer img{width:1em;height:1em}.book-posts{min-width:20rem;max-width:41rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:55rem){.book-toc{display:none}}@media screen and (max-width:41rem){.book-menu{margin-left:-16rem}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace}main,aside nav{padding-top:60px!important}.nav{align-items:center;background-color:#3cd458;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);display:flex;justify-content:center;min-height:30px;padding:10px;position:fixed;width:100%;z-index:2147483647}.nav__a,.nav__a:visited{color:#fff} -------------------------------------------------------------------------------- /docs/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json: -------------------------------------------------------------------------------- 1 | {"Target":"book.min.a8908eea0f762ccc967172c63986bf1f21b06a16707b67b9be89fd69b12e66e7.css","MediaType":"text/css","Data":{"Integrity":"sha256-qJCO6g92LMyWcXLGOYa/HyGwahZwe2e5von9abEuZuc="}} -------------------------------------------------------------------------------- /docs/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.content: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";:root{--gray-100:#f8f9fa;--gray-200:#e9ecef;--gray-500:#adb5bd;--color-link:#0055bb;--color-visited-link:#8440f1;--body-background:white;--body-font-color:black;--icon-filter:none;--hint-color-info:#6bf;--hint-color-warning:#fd6;--hint-color-danger:#f66}@media(prefers-color-scheme:dark){:root{--gray-100:rgba(255, 255, 255, 0.1);--gray-200:rgba(255, 255, 255, 0.2);--gray-500:rgba(255, 255, 255, 0.5);--color-link:#84b2ff;--color-visited-link:#b88dff;--body-background:#343a40;--body-font-color:#e9ecef;--icon-filter:brightness(0) invert(1);--hint-color-info:#6bf;--hint-color-warning:#fd6;--hint-color-danger:#f66}}/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.hidden{display:none}input.toggle{height:0;width:0;overflow:hidden;opacity:0;position:absolute}.clearfix::after{content:"";display:table;clear:both}html{font-size:16px;scroll-behavior:smooth;touch-action:manipulation}body{min-width:20rem;color:var(--body-font-color);background:var(--body-background);letter-spacing:.33px;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:var(--color-link)}img{vertical-align:baseline}:focus{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0;position:relative}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-inline-start:1rem}ul.pagination{display:flex;justify-content:center;list-style-type:none}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-icon{filter:var(--icon-filter)}.book-brand{margin-top:0;margin-bottom:1rem}.book-brand img{height:1.5em;width:1.5em;margin-inline-end:.5rem}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu .book-menu-content{width:16rem;padding:1rem;background:var(--body-background);position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a,.book-menu label{color:inherit;cursor:pointer;word-wrap:break-word}.book-menu a.active{color:var(--color-link)}.book-menu input.toggle+label+ul{display:none}.book-menu input.toggle:checked+label+ul{display:block}.book-menu input.toggle+label::after{content:"▸"}.book-menu input.toggle:checked+label::after{content:"▾"}body[dir=rtl] .book-menu input.toggle+label::after{content:"◂"}body[dir=rtl] .book-menu input.toggle:checked+label::after{content:"▾"}.book-section-flat{margin:2rem 0}.book-section-flat>a,.book-section-flat>span,.book-section-flat>label{font-weight:bolder}.book-section-flat>ul{padding-inline-start:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-post{margin-bottom:3rem}.book-header{display:none;margin-bottom:1rem}.book-header label{line-height:0}.book-header img.book-icon{height:1.5em;width:1.5em}.book-search{position:relative;margin:1rem 0;border-bottom:1px solid transparent}.book-search input{width:100%;padding:.5rem;border:0;border-radius:.25rem;background:var(--gray-100);color:var(--body-font-color)}.book-search input:required+.book-search-spinner{display:block}.book-search .book-search-spinner{position:absolute;top:0;margin:.5rem;margin-inline-start:calc(100% - 1.5rem);width:1rem;height:1rem;border:1px solid transparent;border-top-color:var(--body-font-color);border-radius:50%;animation:spin 1s ease infinite}@keyframes spin{100%{transform:rotate(360deg)}}.book-search small{opacity:.5}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc .book-toc-content{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em;width:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-footer{padding-top:1rem;font-size:.875rem}.book-footer img{height:1em;width:1em;margin-inline-end:.5rem}.book-comments{margin-top:1rem}.book-languages{margin-block-end:2rem}.book-languages .book-icon{height:1em;width:1em;margin-inline-end:.5em}.book-languages ul{padding-inline-start:1.5em}.book-menu-content,.book-toc-content,.book-page,.book-header aside,.markdown{transition:.2s ease-in-out;transition-property:transform,margin,opacity,visibility;will-change:transform,margin,opacity}@media screen and (max-width:56rem){#menu-control,#toc-control{display:inline}.book-menu{visibility:hidden;margin-inline-start:-16rem;font-size:16px;z-index:1}.book-toc{display:none}.book-header{display:block}#menu-control:focus~main label[for=menu-control]{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}#menu-control:checked~main .book-menu{visibility:initial}#menu-control:checked~main .book-menu .book-menu-content{transform:translateX(16rem);box-shadow:0 0 .5rem rgba(0,0,0,.1)}#menu-control:checked~main .book-page{opacity:.25}#menu-control:checked~main .book-menu-overlay{display:block;position:absolute;top:0;bottom:0;left:0;right:0}#toc-control:focus~main label[for=toc-control]{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}#toc-control:checked~main .book-header aside{display:block}body[dir=rtl] #menu-control:checked~main .book-menu .book-menu-content{transform:translateX(-16rem)}}@media screen and (min-width:80rem){.book-page,.book-menu .book-menu-content,.book-toc .book-toc-content{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:normal;font-weight:400;font-display:swap;src:local(""),url(fonts/roboto-v27-latin-regular.woff2)format("woff2"),url(fonts/roboto-v27-latin-regular.woff)format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;font-display:swap;src:local(""),url(fonts/roboto-v27-latin-700.woff2)format("woff2"),url(fonts/roboto-v27-latin-700.woff)format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;font-display:swap;src:local(""),url(fonts/roboto-mono-v13-latin-regular.woff2)format("woff2"),url(fonts/roboto-mono-v13-latin-regular.woff)format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace}@media print{.book-menu,.book-footer,.book-toc{display:none}.book-header,.book-header aside{display:block}main{display:block!important}}.markdown{line-height:1.6}.markdown>:first-child{margin-top:0}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5,.markdown h6{font-weight:400;line-height:1;margin-top:1.5em;margin-bottom:1rem}.markdown h1 a.anchor,.markdown h2 a.anchor,.markdown h3 a.anchor,.markdown h4 a.anchor,.markdown h5 a.anchor,.markdown h6 a.anchor{opacity:0;font-size:.75em;vertical-align:middle;text-decoration:none}.markdown h1:hover a.anchor,.markdown h1 a.anchor:focus,.markdown h2:hover a.anchor,.markdown h2 a.anchor:focus,.markdown h3:hover a.anchor,.markdown h3 a.anchor:focus,.markdown h4:hover a.anchor,.markdown h4 a.anchor:focus,.markdown h5:hover a.anchor,.markdown h5 a.anchor:focus,.markdown h6:hover a.anchor,.markdown h6 a.anchor:focus{opacity:initial}.markdown h4,.markdown h5,.markdown h6{font-weight:bolder}.markdown h5{font-size:.875em}.markdown h6{font-size:.75em}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown a:visited{color:var(--color-visited-link)}.markdown img{max-width:100%;height:auto}.markdown code{padding:0 .25rem;background:var(--gray-200);border-radius:.25rem;font-size:.875em}.markdown pre{padding:1rem;background:var(--gray-100);border-radius:.25rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{margin:1rem 0;padding:.5rem 1rem .5rem .75rem;border-inline-start:.25rem solid var(--gray-200);border-radius:.25rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{overflow:auto;display:block;border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;border:1px solid var(--gray-200)}.markdown table tr:nth-child(2n){background:var(--gray-100)}.markdown hr{height:1px;border:none;background:var(--gray-200)}.markdown ul,.markdown ol{padding-inline-start:2rem}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-inline-start:0;margin-bottom:1rem}.markdown .highlight table tr td:nth-child(1) pre{margin:0;padding-inline-end:0}.markdown .highlight table tr td:nth-child(2) pre{margin:0;padding-inline-start:0}.markdown details{padding:1rem;border:1px solid var(--gray-200);border-radius:.25rem}.markdown details summary{line-height:1;padding:1rem;margin:-1rem;cursor:pointer}.markdown details[open] summary{margin-bottom:0}.markdown figure{margin:1rem 0}.markdown figure figcaption p{margin-top:0}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.markdown .book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid var(--gray-200);border-radius:.25rem;overflow:hidden}.markdown .book-expand .book-expand-head{background:var(--gray-100);padding:.5rem 1rem;cursor:pointer}.markdown .book-expand .book-expand-content{display:none;padding:1rem}.markdown .book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.markdown .book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid var(--gray-200);border-radius:.25rem;overflow:hidden;display:flex;flex-wrap:wrap}.markdown .book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.markdown .book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid var(--gray-100);padding:1rem;display:none}.markdown .book-tabs input[type=radio]:checked+label{border-bottom:1px solid var(--color-link)}.markdown .book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.markdown .book-tabs input[type=radio]:focus+label{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}.markdown .book-columns{margin-left:-1rem;margin-right:-1rem}.markdown .book-columns>div{margin:1rem 0;min-width:10rem;padding:0 1rem}.markdown a.book-btn{display:inline-block;font-size:.875rem;color:var(--color-link);line-height:2rem;padding:0 1rem;border:1px solid var(--color-link);border-radius:.25rem;cursor:pointer}.markdown a.book-btn:hover{text-decoration:none}.markdown .book-hint.info{border-color:#6bf;background-color:rgba(102,187,255,.1)}.markdown .book-hint.warning{border-color:#fd6;background-color:rgba(255,221,102,.1)}.markdown .book-hint.danger{border-color:#f66;background-color:rgba(255,102,102,.1)} -------------------------------------------------------------------------------- /docs/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.json: -------------------------------------------------------------------------------- 1 | {"Target":"book.min.95d69eb6bad8b9707ff2b5d8d9e31ce70a1b84f2ed7ffaf665ffcf00aa7993bd.css","MediaType":"text/css","Data":{"Integrity":"sha256-ldaetrrYuXB/8rXY2eMc5wobhPLtf/r2Zf/PAKp5k70="}} -------------------------------------------------------------------------------- /docs/static/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4rvin2/docli/d6f68218c4bd1130b30b592f8444f46f344080c4/docs/static/avatar.png -------------------------------------------------------------------------------- /examples/git/cmd/clone.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "github.com/alecthomas/repr" 8 | ) 9 | 10 | type Clone struct { 11 | Repository, 12 | Directory string 13 | Verbose, 14 | Quiet, 15 | Progress, 16 | NoCheckout, 17 | Bare, 18 | Mirror, 19 | Local, 20 | NoHardlinks, 21 | Shared bool 22 | RecurseSubmodules string 23 | Jobs int 24 | Template, 25 | Reference, 26 | ReferenceIfAble string 27 | Dissociate bool 28 | Origin, 29 | Branch, 30 | UploadPack string 31 | Depth int 32 | ShallowSince, 33 | ShallowExclude string 34 | SingleBranch, 35 | NoTags, 36 | ShallowSubmodules bool 37 | SeparateGitDir, 38 | Config string 39 | Ipv4, 40 | Ipv6 bool 41 | Filter string 42 | } 43 | 44 | func (c *Clone) Doc() string { 45 | return `usage: git clone [] --repository= --directory= 46 | 47 | arguments: 48 | 49 | -r, --repository repository to clone 50 | -d, --directory path to directory 51 | -v, --verbose be more verbose 52 | -q, --quiet be more quiet 53 | --progress force progress reporting 54 | -n, --no-checkout don't create a checkout 55 | --bare create a bare repository 56 | --mirror create a mirror repository (implies bare) 57 | -l, --local to clone from a local repository 58 | --no-hardlinks don't use local hardlinks, always copy 59 | -s, --shared setup as shared repository 60 | --recurse-submodules= initialize submodules in the clone 61 | -j, --jobs= number of submodules cloned in parallel 62 | --template= directory from which templates will be used 63 | --reference= reference repository 64 | --reference-if-able= reference repository 65 | --dissociate use --reference only while cloning 66 | -o, --origin= use instead of 'origin' to track upstream 67 | -b, --branch= checkout instead of the remote's HEAD 68 | -u, --upload-pack= path to git-upload-pack on the remote 69 | --depth= create a shallow clone of that depth 70 | --shallow-since=