0

Here's the script:

node /app/ganache-core.docker.cli.js — quiet \ — account=”0x873c254263b17925b686f971d7724267710895f1585bb0533db8e693a2af32ff,100000000000000000000" \ — account=”0x8c0ba8fece2e596a9acfc56c6c1bf57b6892df2cf136256dfcb49f6188d67940,100000000000000000000"

I've read What's the magic of "-" (a dash) in command-line parameters?. And I took away that it CAN mean standard input... if the authors of the bash program define it as such.
However, here (link to ganache-core.docker.cli.js github file), I cannot find how or where the author of ganache-core.docker.cli.js would have defined the dash ("-") as standard input. Can someone point that out as well?

Edit: I am looking for confirmation that the dashes do mean standard input for cli args, but more-so looking to understand, WHY they should be definitively be interpreted as stnin when according the linked question above it's only a convention.

Edit2: I suspect the CLI arg parsing library is yArgs

Zach_is_my_name
  • 59
  • 3
  • 14
  • 1
    Is this really what your command line looks like? The dashes here seem to be emdashes, quotes aren't quotes they're "smart" quotes, there's extra spaces. I really doubt that's what your command line looks like. – Brad Sep 18 '20 at 17:52
  • 1
    It has nothing to do with `bash`; like any argument, it's up to the program receiving it to define what it means. – chepner Sep 18 '20 at 17:52
  • 1
    And, the em dashes are probably the result of something like MarkDown replacing `--` with an em dash. – chepner Sep 18 '20 at 17:53
  • @chepner in my question I'm asking where that is defined in the linked source – Zach_is_my_name Sep 18 '20 at 17:54
  • It probably isn't. If the script is using a library to parse the arguments, the logic for interpreting any conventional arguments like `-` or `--` would be defined there. – chepner Sep 18 '20 at 17:55
  • @Brad It does... https://medium.com/@lzhou1110/the-complete-truffle-suite-on-docker-truffle-ganache-drizzle-47ab18b1ec83 – Zach_is_my_name Sep 18 '20 at 17:56
  • @chepner As I stated in the body of my question, I KNOW it's up the program to define what it means... I was looking for where the definition is in the linked source And this might be the library... https://github.com/yargs/yargs – Zach_is_my_name Sep 18 '20 at 17:58
  • @Zach_is_my_name I assure you, this is just a poorly formatted blog article. – Brad Sep 18 '20 at 18:00
  • @Brad that's not right. I ran the script and it works – Zach_is_my_name Sep 18 '20 at 18:01

1 Answers1

1

This command line is just badly formatted. You're reading into something that isn't there. Some Blog software author thought it was a smart idea to auto-reformat the article so that hyphens and such were long dashes and quotes were "smart", etc. In the end, somehow a space ended up after the dash, before the next parameter.

For example, let's look at this:

node /app/ganache-core.docker.cli.js — quiet

Even if we assume that's a regular hyphen -, we know it's not supposed to have a space after it. It's supposed to be -quiet. And, if you have any doubt about this, you can read in the source code where this is defined:

.option('q', {
  group: 'Other:',
  alias: 'quiet',
  describe: 'Run ganache quietly (no logs)',
  type: 'boolean',
  default: false
})

The same is true for -account.

And I took away that it CAN mean standard input... if the authors of the bash program define it as such.

Yes, that's correct. I don't know what this software does, but if it's reading from STDIN, it's not because you told it to on the command line. It's because that's what it does.

Brad
  • 159,648
  • 54
  • 349
  • 530
  • I also suspected that it meant "-quiet" , not, "- quiet". But alas, with a normal dash (not the shift-dash) the script evaluates properly. If you question the validity of what I'm saying I encourage you to see for yourself in a bash+node sandbox with "npm install ganache-cli" as a dependency – Zach_is_my_name Sep 18 '20 at 18:25
  • @Zach_is_my_name I'm sure it does run for you... that's irrelevant. I'm sure it's just getting ignored. – Brad Sep 18 '20 at 18:26
  • Alright. I'll consider further what you're suggesting – Zach_is_my_name Sep 18 '20 at 18:27
  • Absolutely correct. double dash gets auto converted to long dash on many blogging platforms – Zach_is_my_name Sep 27 '20 at 00:10