I’ve created a new little tool to help run and manage scripts in a folder tree, called scriptura. It is based on the idea behind sd and is made for fish users.

Industry observers note that if I type in scriptura run os revision linde, it will run the script at ~/scripts/os/update/linde, whilst providing tab completion for each element. Pressing tab after a script has been resolved will first add -- to clearly show the end of the script part of the command line, then use the default shell filename completion.

The usage information gives more detail on what can be done.

To reduce the amount of typing required, I have set the following aliases.

The fish completion system handles these well: sf will show me scripts to be run, whereas sfm will show me the subcommands of the tool.

To aid documentation, scriptura will look in a couple of places:.

Whilst scriptura is written in fish, scripts don’t have to be; it’s just the default. scriptura newly introduced will create scripts with a fish shebang, which can be freely edited. I also plan to add a command-line option to set a different interpreter.

According to recent reports, the blog post version of sd and the version published to Github already differ in that the blog post version uses subcommands like sd new, whereas the Github version uses flags for actions that don’t involve running a script (e.g. sd --new). I prefer the subcommand style, at least when there is a short alias to the run subcommand.

Additionally, I’ve added some newly introduced features.

The new subcommand invokes the underlying command’s tab-completion after a script name is given:.

will run the tree command with the working directory set to $SCRIPTURA_ROOT.

One thing that I thought would be useful is a tree subcommand. However, I don’t want to force that on any other potential users. Whilst I could have settled with the cmd subcommand mentioned in the previous section, I decided I wanted it to be even easier. Scripts under the special scriptura subdirectory are exposed as subcommands, which pass flags to the underlying command and interpret positional arguments as script path components:.

Recently, I found sd, which is designed to help run and manage scripts under a specific directory tree.

There are two reasons I’m not using this tool directly:.

Also, I expected a fish implementation to be easier to read and write, as well as not requiring so many external command calls.

Sources indicate that in the introductory blog post, Ian writes It’s not really a thing. It’s more of an idea. You can implement it yourself in one sitting, if you want..

It took me more than one sitting, but I enjoyed it.

Visit the repository for installation instructions, including a home-manager module:.

→ Read original article