davydany / sultan

Sultan: Command and Rule over your Shell
https://sultan.readthedocs.io/en/latest/
MIT License
680 stars 35 forks source link

Hyphenated commands: Using apt-get like yum was used in the examples #42

Closed dcbb closed 7 years ago

dcbb commented 7 years ago

In the examples, the following very elegant syntax is used to install something with yum:

with Sultan.load(sudo=True, hostname="myserver.com") as sultan:
  sultan.yum("install -y tree").run()

I'd love to use this with apt-get, but the hyphen collides with Python syntax, obviously. Is there a way to achieve that?

Of course I could do sultan.sudo("apt-get install ...").run(), but I really like the idea of having the sudo in the contest.

Tried apt_get, which fails as _ is not replaced, probably for good reason.

davydany commented 7 years ago

Doh! That's a great catch! I'll fix this bug as part of the next release!

davydany commented 7 years ago

I fixed this in Sultan v0.6. Here is how to use it: http://sultan.readthedocs.io/en/latest/sultan-examples.html#example-10-commands-with-hyphones-i-e-apt-get

I'm closing the ticket, but please reopen it if it is still an issue.