Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
cli: optional message for issue comments
Merged fintohaps opened 2 months ago

The From<String> for Message implementation has an interesting interaction between clap and how Message can be used from the command line.

Note that FromStr is not implemented for Message – which usually what is to be expected for use with clap, but in fact, clap also allows From<String>.

This would make Message be a required option when using rad issue comment.

It is not possible to use default_value_t because that required an implementation of Display, which in this case we do not want to implement. Trying to use default_value = "Message::Edit" also would not work – it uses that as the text.

So, the solution is to mark it as optional, and default to Message::Edit when it is not specified.

fintohaps opened with revision b3e40036 on base 15adb161 +2 -1 2 months ago

The From<String> for Message implementation has an interesting interaction between clap and how Message can be used from the command line.

Note that FromStr is not implemented for Message – which usually what is to be expected for use with clap, but in fact, clap also allows From<String>.

This would make Message be a required option when using rad issue comment.

It is not possible to use default_value_t because that required an implementation of Display, which in this case we do not want to implement. Trying to use default_value = "Message::Edit" also would not work – it uses that as the text.

So, the solution is to mark it as optional, and default to Message::Edit when it is not specified.

lorenz pushed revision 2 b7e79c53 on base c33c26fa +2 -1 2 months ago

Rebase

lorenz merged revision b7e79c53 at eccfd6ba 2 months ago