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

Quoting values in CLI not possible #53

Closed
AndreasVolkmann opened this issue Apr 17, 2021 · 3 comments · Fixed by #57
Closed

Quoting values in CLI not possible #53

AndreasVolkmann opened this issue Apr 17, 2021 · 3 comments · Fixed by #57
Assignees
Labels
bug Something isn't working
Milestone

Comments

@AndreasVolkmann
Copy link
Collaborator

AndreasVolkmann commented Apr 17, 2021

When passing an argument via CLI that contains whitespace, it would be good if quoting was supported.

data class Configuration(
    val notesFileName: String
)

--notes-file-name "My Clippings.txt"

@AndreasVolkmann AndreasVolkmann added the enhancement New feature or request label Apr 17, 2021
@AndreasVolkmann AndreasVolkmann added this to the v3.3.0 milestone Apr 17, 2021
@AndreasVolkmann AndreasVolkmann self-assigned this Apr 17, 2021
@AndreasVolkmann
Copy link
Collaborator Author

@jeggy How would you expect this to work?

Test case:

@Test fun `quote value`() {
    val expected = "expected is this"
    val configuration = Nullable().parse("-s", "\"$expected\"")
    expectThat(configuration).get { str } isEqualTo expected
}

Output:

is equal to "expected is this"
      found ""expected is this""

@jeggy
Copy link
Member

jeggy commented Apr 17, 2021

I would expect it to look at the first character and if that first character is " or ', then it would read anything in between those.

  • hello world -> hello
  • "hello world" -> hello world
  • D'vloper -> D'vloper
  • 'Martin D\'vloper' -> Martin D'vloper
  • "Martin D'vloper" -> Martin D'vloper

@AndreasVolkmann AndreasVolkmann added bug Something isn't working and removed enhancement New feature or request labels Apr 17, 2021
@AndreasVolkmann
Copy link
Collaborator Author

@jeggy Actually this looks like a regression.
I can see we have code that aims to support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants