mirror of
https://github.com/tonydamage/nux-env.git
synced 2025-12-11 13:24:28 +01:00
*: rewrite some files to nuxsh.
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
parent
eef3628269
commit
59b79ea88e
7 changed files with 396 additions and 145 deletions
21
inc/nux/help.nuxsh.sh
Normal file
21
inc/nux/help.nuxsh.sh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env nuxsh
|
||||
@namespace nux.help. {
|
||||
function :shelldoc {
|
||||
sed -r \
|
||||
-e "s/^## ?(.*)/${NC_White}\1${NC_No}/gI" \
|
||||
-e "s/^# ?(.*)/${NC_Bold}\1${NC_No}/gI" \
|
||||
-e "s/^([ a-z0-9.-_]*)::/${NC_Bold}\1${NC_No}/gI" \
|
||||
-e "s/\*\*([^*]*)\*\*/${NC_Bold}\1${NC_No}/gI" \
|
||||
-e "s/\*([^*]*)\*/${NC_White}\1${NC_No}/gI" \
|
||||
--
|
||||
}
|
||||
|
||||
function :comment source {
|
||||
if nux.check.file.exists "$source" ; then
|
||||
grep -E "^\#\#( |$)" "$source" \
|
||||
| cut -d\# -f3- \
|
||||
| cut -d" " -f2- \
|
||||
| nux.help.shelldoc
|
||||
fi
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue