j-bennet / wharfee

A CLI with autocompletion and syntax highlighting for Docker commands.
BSD 3-Clause "New" or "Revised" License
657 stars 41 forks source link

Handle volumes mapping with spaces #149

Closed rockwelln closed 7 years ago

rockwelln commented 7 years ago

When the volumes mapping contain a space, the command is not protected:

wharfee> run -v '/Users/foo/Google Drive:/var/gdrive' alpine:edge ls /var/gdrive /usr/local/bin/docker: Error parsing reference: "Drive:/var/gdrive" is not a valid repository/tag: invalid reference format. See '/usr/local/bin/docker run --help'. Interactive terminal is closed.

j-bennet commented 7 years ago

Thanks for the PR! The def kve is doing the same safe quoting. You could change the fix to this:

    def kv(o, v):
        if o.dest in ['environment', 'volumes']:
            return kve(o, v)
        return '{0}={1}'.format(o.get_name(is_long), v)
rockwelln commented 7 years ago

hmmm right, but the function kve use a splitter '=' to protect the environment variable value. The change you suggested triggers a:

ValueError('not enough values to unpack (expected 2, got 1)',)

Do you want me to change also the function kve to handle volumes?

j-bennet commented 7 years ago

Ah! No, that's an oversight on my part. I'll take your version.

Thanks!

rockwelln commented 7 years ago

Thank's. Great project by the way, I like it ;-).

j-bennet commented 7 years ago

I'm very happy to hear that!