Jump to content

Using parameters to trigger different Terminal commands


Recommended Posts

Hi All,

 

I've just started tinkering with Workflows after finally buying the Powerpack.

 

The first idea that came to my head was to setup a quick trigger to run the show/hide hidden files command in Terminal. Very useful when you're looking .htaccess files etc - and it saves me googling the command every time I want to run it.

 

At the moment I've got two separate workflows - one for hiding, one for showing. Set up on different keywords hiddenhide and hiddenshow.

 

That works fine, but it doesn't seem very elegant. I ideally wanted to combine them into a single Workflow I could run using a parameter. I just couldn't work out how to do it.

 

Ideally I'm thinking using 'hidden show' 'hidden hide' wrapped in one workflow would be much neater.

 

I'm sure I've missed something obvious.

 

Any ideas?

Link to comment

Hi All,

 

I've just started tinkering with Workflows after finally buying the Powerpack.

 

The first idea that came to my head was to setup a quick trigger to run the show/hide hidden files command in Terminal. Very useful when you're looking .htaccess files etc - and it saves me googling the command every time I want to run it.

 

At the moment I've got two separate workflows - one for hiding, one for showing. Set up on different keywords hiddenhide and hiddenshow.

 

That works fine, but it doesn't seem very elegant. I ideally wanted to combine them into a single Workflow I could run using a parameter. I just couldn't work out how to do it.

 

Ideally I'm thinking using 'hidden show' 'hidden hide' wrapped in one workflow would be much neater.

 

I'm sure I've missed something obvious.

 

Any ideas?

 

You could use a keyword input and pass that value into a script that would determine what to do based on your input. In bash, you would simply use an "if" statement to test the value of the input. Something like...

userinput={query}

if [ $userinput == "hide" ]; then
  //do hide
else
  //do show
fi

 

There are several workflows already available that provide this functionality though if you don't feel like making your own

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...