Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the post creation CLI command #117

Closed
RiccardoM opened this issue Mar 12, 2020 · 3 comments · Fixed by #121
Closed

Update the post creation CLI command #117

RiccardoM opened this issue Mar 12, 2020 · 3 comments · Fixed by #121
Assignees
Labels
kind/enhancement Enhance an already existing feature; no "New feature" to add x/posts Post module
Milestone

Comments

@RiccardoM
Copy link
Contributor

Feature description

With #113 we've allowed to create posts with an empty message when there are some medias attached to them. This has caused the CLI command in that case to be very unnatural to use.

Currently the command is

desmoscli tx posts create <subspace> <message> <allows-comments> --flags

Which results (when an empty message is specified) to be:

desmoscli tx posts create "subspace" "" true/false --flags

This is very unnatural for the users and we should probably fix it.

Implementation proposal

What I suggest to do is improve the posting command by making the message an optional flag instead of a required argument:

desmoscli tx posts create <subspace> <allows-comments> \
  --message="My message"
  --flags

Of course, with this implementation inside the CLI tx command handler we need to check that the message is not empty when the medias are, and vice-versa, to make sure that at least one between the message and the medias are specified.

@RiccardoM RiccardoM added kind/enhancement Enhance an already existing feature; no "New feature" to add UX:Improvements x/posts Post module labels Mar 12, 2020
@RiccardoM RiccardoM added this to the v0.4.0 milestone Mar 12, 2020
@kwunyeung
Copy link
Contributor

How about this?

Making the cobra.MinimumArgs to 1. Only <subspace> is mandatory. Keep <message> as an argument but optional. Put --allow-comments as a flag and its default is true if not specified. The command can be like this.

desmoscli tx posts create <subspace> "My message" \
  --allow-comments=false
  --flags

I feel putting the <message> as an argument in the command line is more straightforward.

@RiccardoM
Copy link
Contributor Author

@kwunyeung Love this proposal! Didn't remember viper allows for optional arguments

@leobragaz
Copy link
Contributor

Kwun proposal is perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Enhance an already existing feature; no "New feature" to add x/posts Post module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants