Jump to content

Use snippets with workflow's and arguments


Recommended Posts

Hi All,

I'm a new Alfred user. I've created a workflow that takes in an argument and opens a terminal to ssh into a server. Example: "a-ssh myserver" command will open up a terminal and run "ssh -i file.pem myuser@myserver". Works great. I'd like to take this a step further and map "myserver" to a snippet that contains an actual IP address (saving me from having to manage a host file). So for example I want to have a snippet with keyword "myserver" and snippet value "127.0.0.1" (or a real IP value).  The command I would like to run in alfred is "a-ssh myserver" and have that open up a terminal and run "ssh -i file.pem myuser@127.0.0.1" by referencing the "myserver" snippet. Is this at all possible?

 

Thanks!

Link to comment

Hi All,

I'm a new Alfred user. I've created a workflow that takes in an argument and opens a terminal to ssh into a server. Example: "a-ssh myserver" command will open up a terminal and run "ssh -i file.pem myuser@myserver". Works great. I'd like to take this a step further and map "myserver" to a snippet that contains an actual IP address (saving me from having to manage a host file). So for example I want to have a snippet with keyword "myserver" and snippet value "127.0.0.1" (or a real IP value).  The command I would like to run in alfred is "a-ssh myserver" and have that open up a terminal and run "ssh -i file.pem myuser@127.0.0.1" by referencing the "myserver" snippet. Is this at all possible?

 

Thanks!

 

Alfred's snippets don't work in this manner. What you could do is to make a snippet that you could copy the snippet and use that ip address but that doesn't allow you to use the name. Another way of doing this would be to have a workflow that has a saved list of server name/ip associations. Finally, with DNS or your hosts file set up properly, you wouldn't have to use the ip address, you could just edit your hosts file to know that "myserver" resolves to a certain ip address. It just depends on how you want to set this up. Using the hosts file would probably be the easiest.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...