Farmer CLI syntax improvements

There was a discussion in Move all files to disk plot, remove `--base-path` and `--plot-size` from farmer by nazar-pc · Pull Request #1778 · subspace/subspace · GitHub about CLI syntax for farmer and I agree it could use an improvement.

What we have right now is this:

subspace-farmer --tmp=S farm --reward-address=X
subspace-farmer --farm path=/path1,size=S --farm path=/path2,size=S farm --reward-address=X
subspace-farmer --farm path=/path1,size=S --farm path=/path2,size=S info
subspace-farmer --farm path=/path1,size=S --farm path=/path2,size=S wipe

There were a few awkward things noted:

  • --farm ... farm (farm is used twice)
  • size has no effect on anything in info and wipe commands

I was thinking about introducing scrub command (see Checksummed farmer data · Issue #1723 · subspace/subspace · GitHub) and I think it might make sense to move --farm to arguments of the command instead (it was to the left because we had --base-path in the past that had defaults and subspace-farmer farm --reward-address X looked elegant).

Here is what I am proposing now:

subspace-farmer farm --reward-address=X --tmp=S
subspace-farmer farm --reward-address=X path=/path1,size=S path=/path2,size=S
subspace-farmer info /path1 /path2
subspace-farmer wipe /path1 /path2
subspace-farmer scrub /path1 /path2

So first of all individual farms become just positional arguments. They are the main argument in farming, so it kind of makes sense to not require --farm, --disk, --plot or anything else.
Other commands will also take farms as positional arguments, but will not require size or any special syntax for them.

What do you folks think about this, does it seem logical and/or convenient to you, what would you suggest as a better alternative?

P.S. Yes, you can use = and interchangeably there, I just wanted to clarify the distinction between named and positional arguments in examples.

4 Likes

If reasonable, I prefer named arguments consistently if any are named. I find when I’m not frequently using a command, even though I may recall the parameters I may not recall which are named and have to use —help more often. I think for casual users consistency is simpler. So I would prefer that everything is named and just —param. Less things to remember.

That said, it’s not a big deal and —help is quick to sort things, so I don’t think it’s very important. And I like the suggestion better than the current farm repetition either way.

3 Likes

I agree with jrwashburn. I’d prefer it to be named arguments, but with a short version also. For example, --farm and -f.

farm --farm looks awkward. I was thinking we might remove farm and consider it the default command like Substrate does. WDYT?

Yes, a bit. In that case, the --farm arguments would be passed to subcommands, right?
subspace-farmer --farm path=/path,size=S.
subspace-farmer --farm path=/path,size=S scrub.
And the other arguments can simply be ignored if they are not used in subcommands.
For those who start the farmer manually this will be quite handy, it seems to me.

I do not think we want to support options that are “ignored”, it is confusing and will lead to frustration. CLI should rather reject them with a helpful error message. So most likely all will be passed to subcommands explicitly from now onward.

For scrub size is not necessary, just the path, requiring size was inconvenient and unnecessary.

fewer words are always better

1 Like