You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/01/10 01:20:03 UTC

[GitHub] [mynewt-core] ccollins476ad opened a new pull request #2153: sys/config: Allow spaces in value passed to CLI

ccollins476ad opened a new pull request #2153: sys/config: Allow spaces in value passed to CLI
URL: https://github.com/apache/mynewt-core/pull/2153
 
 
   This is somewhat hacky but I think it solves the common case in a straightforward way.  Currently it is not possible to write a conf value containing spaces using the CLI.  If the user passes multiple values to the `config` write CLI command, e.g.,
   ```
   config id/serial firstname lastname
   ```
   
   the CLI command fails.
   
   This PR changes the config command handler so that spaces are allowed.  All value tokens are concatenated into a space-delimited string, and the result is written to the config setting.
   
   Issues with this approach:
   * All whitespace characters get converted into regular spaces.  I don't think this is a huge issue since it is better than not allowing spaces at all.
   
   I think anything better would be overkill (e.g., shell-style parsing).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] ccollins476ad closed pull request #2153: sys/config: Allow spaces in value passed to CLI

Posted by GitBox <gi...@apache.org>.
ccollins476ad closed pull request #2153: sys/config: Allow spaces in value passed to CLI
URL: https://github.com/apache/mynewt-core/pull/2153
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] sjanc commented on issue #2153: sys/config: Allow spaces in value passed to CLI

Posted by GitBox <gi...@apache.org>.
sjanc commented on issue #2153: sys/config: Allow spaces in value passed to CLI
URL: https://github.com/apache/mynewt-core/pull/2153#issuecomment-572922056
 
 
   how about using "foo bar" syntax?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] ccollins476ad commented on issue #2153: sys/config: Allow spaces in value passed to CLI

Posted by GitBox <gi...@apache.org>.
ccollins476ad commented on issue #2153: sys/config: Allow spaces in value passed to CLI
URL: https://github.com/apache/mynewt-core/pull/2153#issuecomment-574870268
 
 
   I no longer need this feature, so I am closing this PR.  If we need this later, we can implement something better at that time.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] ccollins476ad commented on issue #2153: sys/config: Allow spaces in value passed to CLI

Posted by GitBox <gi...@apache.org>.
ccollins476ad commented on issue #2153: sys/config: Allow spaces in value passed to CLI
URL: https://github.com/apache/mynewt-core/pull/2153#issuecomment-573134827
 
 
   > how about using "foo bar" syntax?
   
   That is what I meant by "shell-style parsing".  That just seemed like a bit much ("overkill").
   
   I don't think it's a deal breaker, but a quoting scheme also has backwards-compatibility implications.  Tokens get split by the shell package, then the token list gets passed to the appropriate command handler (as an `argc`, `argv` pair).  So any changes we make to token splitting will affect all shell commands.  If we want quoting to preserve literal text, then that changes the meaning of `"` characters.  If a user currently puts quotes in shell arguments, this solution would break their use case.  Of course we would add a way to escape quote characters (e.g., `\"`), but again - backwards compatibility.
   
   My preference is to go with this simpler solution now.  This solution is compatible with any smarter feature that gets added to the shell package, so we could always add that later as needed.  If you (or anyone else) deem this as the wrong solution, I am totally fine with that - I can take a look at implementing proper argument parsing.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services