Re: [jclouds/jclouds-cli] JCLOUDS-1189: Handle arguments with spaces (#34)

2016-11-02 Thread Andrew Gaul
andrewgaul commented on this pull request.



> @@ -254,7 +254,12 @@ private void run(final CommandProcessorImpl 
> commandProcessor, String[] args, fin
 if (i > 0) {
 sb.append(" ");
 }
-sb.append(args[i]);
+if (args[i].contains(" ")) {
+// quote arguments with spaces
+sb.append("\"").append(args[i]).append("\"");

I tested quote handling with 1.9.1 and 2.0.0 with this commit:

```
$ bin/jclouds-cli-1.9.1/bin/jclouds blobstore read $CONTAINER '"' out
IO error: unexpected EOT looking for matching quote: "

$ bin/jclouds-cli-1.9.1/bin/jclouds blobstore read $CONTAINER 'foo "bar"' out
Error executing command jclouds:blobstore-read: too many arguments specified
```

```
$ bin/jclouds-cli-2.0.0-SNAPSHOT/bin/jclouds blobstore read $CONTAINER '"' out
IO error: unexpected EOT looking for matching quote: "

$ bin/jclouds-cli-2.0.0-SNAPSHOT/bin/jclouds blobstore read $CONTAINER 'foo 
"bar"' out
Blob not found: foo bar not found in container gaulovrclk-us-east-1: while 
getting blob
```

Karaf eats the quotes but we do not regress the behavior.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-cli/pull/34

Re: [jclouds/jclouds-cli] JCLOUDS-1189: Handle arguments with spaces (#34)

2016-11-02 Thread Ignasi Barrera
nacx approved this pull request.





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-cli/pull/34#pullrequestreview-6807706

Re: [jclouds/jclouds-cli] JCLOUDS-1189: Handle arguments with spaces (#34)

2016-11-02 Thread Ignasi Barrera
nacx commented on this pull request.



> @@ -254,7 +254,12 @@ private void run(final CommandProcessorImpl 
> commandProcessor, String[] args, fin
 if (i > 0) {
 sb.append(" ");
 }
-sb.append(args[i]);
+if (args[i].contains(" ")) {
+// quote arguments with spaces
+sb.append("\"").append(args[i]).append("\"");

Given [this 
comment](http://karaf.922171.n3.nabble.com/Karaf-shell-command-argument-with-space-td4027039.html#a4027040)
 I assume arguments with spaces in karaf need to be quoted. The problem is just 
how we "pass" those quotes from our runner script to the Main class, to then 
build the proper karaf command.
Given the link above (despite not being a karaf expert), I'd say this approach 
is OK.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-cli/pull/34

Re: [jclouds/jclouds-cli] JCLOUDS-1189: Handle arguments with spaces (#34)

2016-10-25 Thread Andrew Gaul
andrewgaul commented on this pull request.



> @@ -254,7 +254,12 @@ private void run(final CommandProcessorImpl 
> commandProcessor, String[] args, fin
 if (i > 0) {
 sb.append(" ");
 }
-sb.append(args[i]);
+if (args[i].contains(" ")) {
+// quote arguments with spaces
+sb.append("\"").append(args[i]).append("\"");

This addresses my symptoms but how should this handle quotes?  The felix 
documentation does not discuss this.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-cli/pull/34#pullrequestreview-5750979

[jclouds/jclouds-cli] JCLOUDS-1189: Handle arguments with spaces (#34)

2016-10-25 Thread Andrew Gaul

You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-cli/pull/34

-- Commit Summary --

  * JCLOUDS-1189: Handle arguments with spaces

-- File Changes --

M assembly/src/main/filtered-resources/unix/bin/jclouds (3)
M runner/src/main/java/org/jclouds/cli/runner/Main.java (7)

-- Patch Links --

https://github.com/jclouds/jclouds-cli/pull/34.patch
https://github.com/jclouds/jclouds-cli/pull/34.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-cli/pull/34