I hereby decree

by David LeMieux

 

A long while ago I decided to get my toes wet with Ruby, feel the waters and ease myself in to an ocean of new code. To do so I made a simple command line utility to help manage repeated tasks through aliases. I called it "please" because that way when you use the command it looks like you are asking the computer to do something for you and you are being polite. Technology and decency all wrapped up in one.

Please is available on github and works on Mac OS X. It is also available as a ruby gem:

$ gem install please-command-alias-manager


although there really isn't much reusable code and therefor breaks some of the gem mentality/pattern. Oops.

Lets say you have some long command you have to run regularly, like tail a specific log file. With please

$ tail -f /Users/username/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt


becomes

$ please tail flash log


Since you can define the aliases in natural language, you don't have to worry about remembering the one-word or oft-hyphenated command from ~/.bash_profile. Here is another example.

$ networksetup -setairportpower airport {on/off}


becomes

$ please toggle wifi

on/off _


This one demonstrates that aside from simple aliasing you can also use a replacement/template like syntax to natural language prompts for command line arguments. Here is one last example:

 please --add "save clipboard as audio" "pbpaste | say -v {voice} -o ~/Desktop/{filename}"


This creates the command "please save clipboard as audio" and then prompts you for the voice and file name.

I've been using it regularly for over half a year now and I recently gem-ified it as well as added some nice new features. I figured I would let others have access to it if they wanted. Don't go looking in to it too deeply though, it is far from perfect. As always, feedback is welcome.

 

blog comments powered by Disqus