A simple script to centralize and document frequently used commands for projects.
Go to file
mitchell 207b02bfef Update help and do commands 2020-11-29 01:23:39 -05:00
functions Update help and do commands 2020-11-29 01:23:39 -05:00
LICENSE Add LICENSE and README.md, and update run scripts comments 2020-09-29 01:45:47 -04:00
README.md Fix README.md links for github 2020-10-29 13:55:12 -04:00
sw Update help and do commands 2020-11-29 01:23:39 -05:00
swim.fish.example Update help and do commands 2020-11-29 01:23:39 -05:00

README.md

swim.fish

swim.fish is a simple executable script and fish-based "DSL". It lets you easily compile and catalog your project's most frequently run commands. Think make or npm run.

Table of Contents

Getting Started

^ Back to Top ^

The easiest way to get started is by copy this repository's swim.fish to your own project's root directory. Then replace this projects command functions with your own. They look like this:

function swim_your_command_name -a one_of n_args -d 'A sentence description of your command'
    fish shell content
    ...
end

The required prefix of swim_ can be configured, by setting the cmd_func_prefix global variable (located at the top of example swim.fish).

Install sw

^ Back to Top ^

The only dependency is fish itself.

The easiest way to install sw is by running this

curl -fsS https://raw.githubusercontent.com/mitchell/swim.fish/master/sw >sw && chmod +x sw

then copying sw to your preferred location in your binpath, like /usr/local/bin on .

Included Commands

^ Back to Top ^

The following commands are included.

  • help:
    • Examples:
      • sw help: Displays all top-level commands and their descriptions
      • sw help <command>: Displays the commands definition
      • sw <command group> help: Displays the group's commands and their descr
    • Aliases:
      • --help: If used with command group display group help, otherwise display command definition.
      • -h: Same as above
  • do:
    • Examples:
      • sw do <command> [arg ...], <command> [arg ...], ...: Run the specified commands in sequence

Self-executable swim.fish

^ Back to Top ^

If you wish to make your swim.fish file self-executable instead of installed sw. Then all you have to do is add

#!/usr/bin/env fish

to the top of your swim.fish, and

curl -fsS https://raw.githubusercontent.com/mitchell/swim.fish/master/importable_sw.fish | source
run_swim_command $cmd_func_prefix $argv

to the bottom of your file.

Then you can run it like ./swim.fish <command>.