mmeyer724 / sshmenu

MIT License
56 stars 12 forks source link

Add support for ssh command line options #2

Closed RealJTG closed 8 years ago

RealJTG commented 8 years ago

Fixes #1 Adds "options" configuration key

{"targets": [
    {
        "friendly": "altssh dev server available behind firewall",
        "host": "user@dev.alt",
        "options": {
            "p": "443"          
        }
    }
]}

Will execute ssh user@test.dev -p 443

mmeyer724 commented 8 years ago

Hi,

First off, thank you for the contribution! I do have a few small suggestions, let me know what you think.

{  
   "targets":[  
      {  
         "friendly":"altssh dev server available behind firewall",
         "host":"user@dev.alt",
         "options":[  
            "-p443",
            "-vvv"
         ]
      }
   ]
}

If we do this, I believe we can also use os.execvp(file, args) to avoid unpacking the options (I haven't played around with this at all).

Otherwise, this looks like a very useful addition. I very recently had the need to add a target with a non-standard port, but I never wrote out the code for it, so this is pretty good timing for me.

RealJTG commented 8 years ago

Yep, sounds reasonable.

RealJTG commented 8 years ago

Done. Also moved command line options between "ssh" and "hostname" where they sould be (otherwise user may accidentally execute option without dash as command on remote host) and added indentation to newly created config file.

mmeyer724 commented 8 years ago

Nice! I'm going to test it out myself quickly, will comment back/merge afterwards.

mmeyer724 commented 8 years ago

Tagged in 0.0.2, release pushed to pypi + homebrew formula updated.

Thanks!