super-cli-example
v0.0.1
Published
Example for building your own CLI with ycli features
Readme
Super CLI Example
It shows how you could create your own cli using ycli.
Installation
Use ONE of the following methods:
# install via npm
npm install --global super-cli-example
# install via git
git clone [email protected]:daKmoR/super-cli-example.git && cd super-cli-example && npm install
# if you have problems you can manually call ./install.sh
# if installed via npm it would be cd $(npm root -g)/super-cli-example && ./install.shRestart your Terminal/Console!!!
Usage
Just open a terminal and type
$ super-cli
The Super CLI Example
Available Commands:
super-cli bower
super-cli config
super-cli git-lab
super-cli git
super-cli help
super-cli multiple
super-cli release
super-cli self-update
super-cli util
super-cli wct
Example:
super-cli self-updateCreate your own CLI from this
Let's create a new cli and call it "Dust".
git clone [email protected]:daKmoR/super-cli-example.git- Replace
SUPER_CLI_DIRwithDUST_DIReverywhere - Rename
super-cli.shtodust.sh - Setup dust.sh with something like this
function dust() {
ycliName="dust";
ycliLongName="Dust CLI";
ycliSubCli=1;
ycliPluginsPaths=(${ycliFoundPluginsPaths[@]});
# we want to also have all ycli script available inside dust
ycliPluginsPaths+=("$YCLI_DIR"); # comment this line out if you only want YOUR commands visible
ycliPluginsPaths+=("$DUST_DIR");
# define the path to a second cli version
if [[ ! " ${ycliCliPaths[@]} " =~ " $DUST_DIR/dust.sh " ]]; then
ycliCliPaths+=("$DUST_DIR/dust.sh");
fi
ycli "$@"
ycliSubCli=0;
}- Replace
super-cliwithdustininstall.shanduninstall.sh - Run
./install.sh - Restart Console/Terminal or run
source ~/.bashrc - Enjoy your own new CLI
