yargs/yargs

allow to pass arguments via ENV variables

Open

#856 建立於 2017年4月15日

在 GitHub 查看
 (7 留言) (2 反應) (0 負責人)JavaScript (10,829 star) (1,053 fork)batch import
Help Wantedenhancement

描述

This in relation to this issue http://stackoverflow.com/q/43396569/368691

Basically, sometimes it is very inconvenient to pass arguments to the program. Extending the stack overflow example, I need to redeclare the entire docker CMD just to be able to say that the program needs to execute "passthrough-service":

args: [
  "node",
  "dist/bin/forwardProxy.js",
  "passthrough-service",
  "--listen",
  "http://0.0.0.0:8080",
  "--forward",
  "http://cache-proxy:8080"
]

It would be awesome if I could to:

YARGS_ARGS=passthrough-service node dist/bin/forwardProxy.js

# equivalent to
# node dist/bin/forwardProxy.js passthrough-service

Note: I am well aware that I can pass options via environment variables. This issue is about the CLI arguments ("commands") passed to the program.

貢獻者指南