Revamping na (Next Action CLI)
I have a friend (hi Jeff) who has really dug into using some of my command line tools like Howzit and na. Working with him on setting them up in his own environment has inspired some refactoring of both tools. I mentioned some major updates to Howzit last month, but had only made minor fixes to na up until this week.
I had a sleepless night on Sunday and decided to dig into patching up na. It was an unwieldy Bash script that was a real pain to fix, and took extra finagling to make it work in shells other than Bash. So I completely rewrote it and turned it into a gem-based CLI. The new CLI is backwards compatible, but adds new features and is a more manageable tool.
Now you can install na as easily as
gem install na (you may need
sudo gem install na, depending on your Ruby setup). Run
na help for a list of all commands, and run
na help COMMAND for options and details on each command. All of that output is laid out in the docs.
So let me back up and explain a bit for those who haven’t already heard of na. It’s a tool for adding and viewing project-specific “next actions” in a TaskPaper file stored in each project directory. When you need to make a note about a new feature you want to add or a bug you discovered in project you’re working on, you just run
na add "Fix output formatting @bug" --priority 4 and the task is added to a TaskPaper file in an Inbox project, creating a new file if needed. Running
na next will show you all the next actions in all TaskPaper files in the current directory. It can traverse subdirectories as well, and it stores a database of every TaskPaper file it sees so you can call up a project’s actions with
na next PROJECT_NAME, even when you’re not in that directory.
I love using na with prompt hooks. It can now output and install prompt hooks for Bash, Zsh, and Fish. Just run
na prompt install and it will detect your current shell and install the appropriate file. Once installed, every time you
cd into a project, it will automatically show you your next actions for that project. It’s nifty.
When it was a Bash script you had to use environment variables to save configuration options. Now you can set flags like alternate file extensions or default next action tag and save them to a config file in one command:
na --ext md --na_tag next initconfig.
You can also now search your TaskPaper files by tag (and tag value) or fuzzy search strings, allowing you to organize your todos in a flexible way. Want to see just your @maybe tasks?
na tagged maybe. You can do boolean searches for multiple tags matching tasks containing any or all tags specified.
As I mentioned, I kept it backwards compatible for the sake of anyone who’s already had it integrated into their workflow. It’s subcommand-based now, so you run commands like
na next and
na add, whereas previously you would run
na -a. The latter still works. Once users have had a chance to transition to the new subcommand format, I’ll remove some of the legacy switches and flags.
Check out the na project page for installation and usage instructions. It’s not as massive a tool as something like Doing, but it does what it needs to quite well and has long been an indispensable part of my toolkit.