# Farmer CLI syntax improvements

**URL:** <https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603>\
**Category:** Feedback & Suggestions\
**Tags:** cli, farmer, advanced-cli, ux\
**Created:** [August 15, 2023, 2:14am UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603 "2023-08-15T02:14:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.autonomys.xyz/nazar-pc/32/6_2.png) [@nazar-pc](https://forum.autonomys.xyz/u/nazar-pc)\
**Post date:** [August 15, 2023, 2:14am UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603/1 "2023-08-15T02:14:37Z")

</div>

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](https://github.com/subspace/subspace/pull/1778) about CLI syntax for farmer and I agree it could use an improvement.

What we have right now is this:

```auto
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](https://github.com/subspace/subspace/issues/1723)) 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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![jrwashburn](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.autonomys.xyz/jrwashburn/32/358_2.png) [@jrwashburn](https://forum.autonomys.xyz/u/jrwashburn)\
**Post date:** [August 16, 2023, 12:15pm UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603/2 "2023-08-16T12:15:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.autonomys.xyz/nazar-pc/32/6_2.png) [@nazar-pc](https://forum.autonomys.xyz/u/nazar-pc)\
**Post date:** [August 17, 2023, 8:44am UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603/3 "2023-08-17T08:44:31Z")

</div>

> <https://github.com/subspace/subspace/pull/1835>
>
> This is a follow-up to https://github.com/subspace/subspace/pull/1778 and implem…ents proposal from https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603.
> 
> I also removed CLI arguments we did not use anyway and re-arranged remaining arguments such that those users will specify/change more likely appear sooner in help message.
> 
> I also tweaked some help messages and updated docs to mention \`scrub\` command.
> 
> Syntax before and after this PR:
> | Before | After |
> | ------ | ----- |
> | --tmp X farm | farm --tmp X |
> | --farm path=/path,size=X farm | farm path=/path,size=X |
> | --farm path=/path,size=X scrub | scrub /path |
> 
> \### Code contributor checklist:
> \* \[x\] I have read, understood and followed \[contributing guide\](https://github.com/subspace/subspace/blob/main/CONTRIBUTING.md)

---

<div class="post-metadata">

**Author:** ![SeryogaLeshii](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.autonomys.xyz/seryogaleshii/32/551_2.png) [@SeryogaLeshii](https://forum.autonomys.xyz/u/SeryogaLeshii)\
**Post date:** [August 17, 2023, 5:04pm UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603/4 "2023-08-17T17:04:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.autonomys.xyz/nazar-pc/32/6_2.png) [@nazar-pc](https://forum.autonomys.xyz/u/nazar-pc)\
**Post date:** [August 17, 2023, 5:36pm UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603/5 "2023-08-17T17:36:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SeryogaLeshii](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.autonomys.xyz/seryogaleshii/32/551_2.png) [@SeryogaLeshii](https://forum.autonomys.xyz/u/SeryogaLeshii)\
**Post date:** [August 18, 2023, 8:47am UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603/6 "2023-08-18T08:47:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.autonomys.xyz/nazar-pc/32/6_2.png) [@nazar-pc](https://forum.autonomys.xyz/u/nazar-pc)\
**Post date:** [August 18, 2023, 9:04am UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603/7 "2023-08-18T09:04:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wilyam](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@wilyam](https://forum.autonomys.xyz/u/wilyam)\
**Post date:** [August 19, 2023, 10:29am UTC](https://forum.autonomys.xyz/t/farmer-cli-syntax-improvements/1603/8 "2023-08-19T10:29:37Z")

</div>

fewer words are always better
