[Bug 921286] Review Request: cmd - wrap bash functions into a command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=921286

--- Comment #2 from Juan Manuel <juanmabcmail@xxxxxxxxx> ---
This command allows to make unexistent commands available on the shell like:

$ function test_test { echo "testtest"; }
$ function test_testarg { echo "testarg <$1>"; }
$ function test_testopt { if [[ ! -z "$1" ]]; then echo "testopt <$1>"; else
echo "testopt
"; fi; }
$ function test_init { echo "testinit <$@>"; }
$ function test_main { echo "testmain <$@>"; }
$ export -f test_test test_testarg test_testopt test_init test_main
$ function testfly { cmd --cmd "testfly" --cmdname "test fly" --cmddescription
"test fly" --cmdexplanation "tests cmd on the fly" --cmdversion "0.4.16"
--cmdauthor "Test Author" --cmdmonth "May" --cmdyear "2013" --cmdbugreport
"test@xxxxxxxxxx" --cmdhomepage "http://test.homepage.tld"; --cmdusage "
test [OPTIONS]" --cmdexample "test" --cmdoption "/t/test/show a test
message/test_test/" --cmdoption "/a:/testarg:/show a test message with
argument/test_testarg/ARG/" --cmdoption "/o::/testopt::/show a test message
with optional argument/test_testopt/ARG/" --cmdextrahelp "You can play with
option argument passing." --cmdextranotes "For more information, check package
documentation." --cmdinit "test_init" --cmdmain "test_main" -- "$@"; }

Hence running like this:

$ testfly --help
Usage: test [OPTIONS]
test fly
Example: test

tests cmd on the fly

Mandatory arguments for long options are mandatory for short options too.
  -t, --test                                    show a test message
  -a, --testarg=ARG                             show a test message with
argument
  -o, --testopt[=ARG]                           show a test message with
optional argument
  -h, --help                                    show a help message
  -v, --version                                 show the program version
  -m, --man                                     show a man page
You can play with option argument passing.
Execute 'bash -c "man <(test --man)"' to see the runtime manpage.

Report bugs to <test@xxxxxxxxxx>.
testfly (test fly) home page <http://test.homepage.tld>.
For more information, check package documentation.

$ testfly --version
0.4.16

$ man <(test --man)
...

$ testfly --test --testarg arg --testopt --testopt=arg a b c
testtest
testarg <arg>
testopt
testopt <arg>
testmain <a b c>

It's an smart wrapper (still being a command) allowing to make commands faster,
or on the fly without losing standards. Provides a cmd binary and a cmd.sh for
inclusion, just needing one to be used.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug https://bugzilla.redhat.com/token.cgi?t=IDNpNmL3cw&a=cc_unsubscribe
_______________________________________________
package-review mailing list
package-review@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/package-review





[Index of Archives]     [Fedora Legacy]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]