Comments (7)
Would be cool if each command or group of commands also hd a video tutorial, which the help prompt after dumping the usage data, does a confirm prompt if they want to open the video tutorial. It can go on the bevry software channel.
from dorothy.
Found these.
https://en.wikipedia.org/wiki/Command-line_interface#Command_description_syntax
- angle brackets for required parameters: ping
- square brackets for optional parameters: mkdir [-p]
- ellipses for repeated items: cp [source2…]
- vertical bars for choice of items: netstat {-t|-u}
As such, ellipses inside the bracket, at the end. Square brackets denote exclusive options.
https://linux.die.net/man/7/man-pages
For commands, this shows the syntax of the command and its arguments (including options); boldface is used for as-is text and italics are used to indicate replaceable arguments. Brackets ([]) surround optional arguments, vertical bars (|) separate choices, and ellipses (...) can be repeated.
Also, it states several sections and what is expected in those sections...
The following list elaborates on the contents of each of the above sections.
...
As such, something like this:
cat <<-EOF >/dev/stderr
USAGE:
get-profile <property> -- ...<source>
ARGUMENTS:
<property> can be any of these: ${property_options[*]}>
<source> can be any multiple of these: ${source_options[*]}
<source> also supports ... which will be expanded to all of options
RETURNS:
Success if there was a value. Value will be outputted.
Failure if no value was found. Nothing will be outputted.
EOF
Becomes this:
and the much more complex code:
cat <<-EOF >/dev/stderr
$(echo-style --h1='SYNOPSIS')
$(
echo-style \
--bold='get-profile ' \
--italic='<' \
--bold="$(
echo-join \
"$(
echo-style --disable-bold+italic='|' --bold
)" \
-- "${property_options[@]}"
)" \
--disable-bold+italic="> [" \
--bold='-- ' \
--italic='...<' \
--bold="$(
echo-join \
"$(
echo-style --disable-bold+italic='|' --bold
)" \
-- "${source_options[@]}" '...'
)" \
--disable-bold+italic='>]'
)
$(echo-style --h1='OPTIONS')
$(
echo-style \
--bold='get-profile ' \
--italic='<property> [' \
--bold='-- ' \
--italic='...<source>]'
)
<property> can be any of these:
$(echo-join ', ' -- "${property_options[@]}")
<source> can be any multiple of these:
$(echo-join ', ' -- "${source_options[@]}" '...')
if ... is used, the ... will expand to all sources
$(echo-style --h1='EXIT STATUS')
Success if there was a value. Value will be outputted.
Failure if no value was found. Nothing will be outputted.
EOF
note that the unix convention of ... inside to specify recurrance doesn't work, as ... inside means an option, as such, we will break the unix convention, and place repitition indicators outside
Alright, settling on this:
cat <<-EOF >/dev/stderr
$(echo-style --h1='SYNOPSIS')
$(
echo-style \
--bold='get-profile ' \
--italic='[' \
--bold="$(
echo-join \
"$(
echo-style --disable-bold+italic='|' --bold
)" \
-- "${property_options[@]}"
)" \
--disable-bold+italic="] [" \
--bold='-- ' \
--italic='...[' \
--bold="$(
echo-join \
"$(
echo-style --disable-bold+italic='|' --bold
)" \
-- "${source_options[@]}" '...'
)" \
--disable-bold+italic=']]'
)
$(echo-style --h1='DESCRIPTION')
Attempts to retrieve a profile property from one or more sources.
$(echo-style --h1='CONFIGURATION')
The $(echo-style --bold='profile.bash') configuration file will be sourced.
$(echo-style --h1='OPTIONS')
$(
echo-style \
--bold='get-profile ' \
--italic='[property] [' \
--bold='-- ' \
--italic='...[source]]'
)
$(echo-style --italic='property')
if provided, it must be one of these values:
$(
echo-style --bold="$(
echo-join "$(
echo-style --disable-bold+italic=', ' --bold
)" -- "${property_options[@]}"
)"
)
if omitted, you will be prompted to make a selection.
$(echo-style --italic='source')
if provided, it must be one or more of these values:
$(
echo-style --bold="$(
echo-join "$(
echo-style --disable-bold+italic=', ' --bold
)" -- "${source_options[@]}" '...'
)"
)
if omitted, all sources will be used.
if $(echo-style --bold='...') is used, it will be expanded to all sources.
$(echo-style --h1='EXIT STATUS')
$(echo-style --green='[0] if a value was found.')
stdout will output the fetched value.
stderr will be empty.
$(echo-style --red='[6 Device not configured] if no value was found.')
stdout will be empty.
stderr will output that the result is undefined.
$(echo-style --h1='EXAMPLES')
Attempt to retrieve the name from the first available source, these are all equivalent:
$(echo-style --bold='get-profile name')
$(echo-style --bold='get-profile name --')
$(echo-style --bold='get-profile name -- ...')
Attempt to retrieve the name from only npm:
$(echo-style --bold='get-profile name -- npm')
Attempt to retrieve the name from the first available source, starting with npm, then git:
$(echo-style --bold='get-profile name -- npm git ...')
EOF
from dorothy.
Rather than man
pages for each command, it is best to do --help
flags for each of them, as it is easier and more robust, for example:
Lines 5 to 25 in fe27c95
from dorothy.
For convention, I believe this one is good enough to roll out to the rest:
from dorothy.
@molleweide can I assign this to you?
from dorothy.
For implementation, we should note a better way of doing the multiline echos
from dorothy.
@molleweide can I assign this to you?
Yo I'll try to look at this and see what I can do.
from dorothy.
Related Issues (20)
- Review remaining commands
- Compatibility with Ubuntu 22.04 HOT 1
- Dump Resilio for Syncthing HOT 1
- Review macOS bash v3 compat HOT 1
- Tracking cross-OS utility support HOT 1
- setup-git oddities on ubuntu on raspi HOT 1
- setup-python failure on ubuntu on raspi
- Hermetic Installation HOT 11
- `GITHUB` can fail on `setup-util` when rate limits are reached
- Suggestion: `fs-dirname` should support non-existing paths HOT 2
- Make `setup-extras` optional, such that `setup-linux` can occur without installing every ecosystem. HOT 1
- Drop non-XDG support for Dorothy HOT 1
- `debug-bash --dorothy` to `source "$(which ...)"` as much as possible HOT 2
- Consider `setup-util --order=...` instead of `-- order` HOT 1
- Consider porting larger commands to Rust HOT 1
- tmux problem / not working after updating dorothy [SOLVED]
- setup-util: support dmgs HOT 1
- Ongoing: additional linux distro support (mageia, nix, gentoo)
- setup-dns: add AdGuardDNS (sucessor to AdGuardHome) HOT 1
- Suggestion: revise the installation flow HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dorothy.