项目作者: carballosa

项目描述 :
Demo cli app implemented using npm commander, progress and ora (spinner)
高级语言: JavaScript
项目地址: git://github.com/carballosa/cli-app.git
创建时间: 2018-11-01T16:51:12Z
项目社区:https://github.com/carballosa/cli-app

开源协议:

下载


cli-demo

demo cli app

Get a local copy

  1. Clone this repository

    1. git clone https://github.com/carballosa/cli-demo.git
    2. cd commander-test
  2. Install app dependencies

    1. npm install
  3. Build the app to the dist folder

    1. npm run build
  4. Deploy app’s entry point to the bin folder

    1. npm run deploy
  5. Install app as a global cli package

    | WARNING: You need to perform this step from a console or terminal that is running as the user for which you want to install this command. For example, if you run it from VSCode integrated console, which normally runs as admin, then this command will only be available in consoles running as admin. |
    | —- |

    1. npm install -g

Run the app

  1. See app usage

    1. > pizza -h
    1. Usage: pizza [options]
    2. Order a pizza with your preferred toppings
    3. Options:
    4. -v, --version output the version number
    5. -p, --peppers Add peppers
    6. -P, --pineapple Add pineapple
    7. -b, --bbq-sauce Add bbq sauce
    8. -c, --cheese [name] Add the specified type of cheese
    9. -$, --card <name> Indicate the payment card (default: visa)
    10. -h, --help output usage information
  2. Check installed version

    1. > pizza -v
    1. 0.1.0
  3. Run without arguments

    1. > pizza
    1. you ordered a standard pizza
    2. you will pay with visa
  4. Run with a non-default argument (not visa)

    1. > pizza -$ mastercard
    1. you ordered a standard pizza
    2. you will pay with mastercard
  5. Run combining serveral flag arguments (multiple toppings)

    1. > pizza -pbc
    1. you ordered a pizza with:
    2. - peppers
    3. - bbq
    4. - standard cheese
    5. you will pay with visa
  6. Run with a non-flag argument (not standard cheese)

    1. > pizza -c mozzarella
    1. you ordered a pizza with:
    2. - mozzarella cheese
    3. you will pay with visa