No, ScriptHaus runs 100% locally. At no time does ScriptHaus transfer any of your scripts, markdown, or history to a remote server.
You can use ScriptHaus on Mac OS X (recommended) and Linux systems. Windows is not currently supported, please reach out if you would like to help port and test it.
ScriptHaus supports "sh", "bash", "zsh", "tcsh", "ksh", "fish", "python", "python2", "python3", "js", and "node". Note: "js" and "node" are synonyms, and care should be taken when using "sh" as it is just an alias for another shell (so it is not portable).
For the shells, the command is passed using "-c" (so it should with any compatible shell). Python is executed using "-c" and node commands are executed using "--eval". For shells, $0 is set to the command-name (python and node do not allow it to be overridden).
Sure (same for BUILD.md or any other markdown file you already have)! Any code fence can be made executable by adding:
# @scripthaus command [name] - [short-description]
Now you can run it from the command-line using:
scripthaus run ./README.md::[name]
You can save the last command you typed by using scripthaus "add". Add will add a new code-fenced scripthaus block to the end of the markdown file specified.
scripthaus add ./commands.md::new-command-name -t bash -m "my cool command" -c "!!"
For more help/options you can run scripthaus help add
. Note that if the markdown
file you wish to add to does not exist, scripthaus will refuse to add the command,
just "touch" file first and the add will work. Since playbooks are just markdown
files, you can edit them however you normally edit markdown.
scripthaus show [markdown-file]
This will show you the scripthaus commands in the given markdown file (with their short descriptions). If you want to get help on a specific command run:
scripthaus show [markdown-file]::[command]
This will show the full code for the command as well as the help text from the surrounding markdown.
Help text is generated by traversing upwards from the code fence that holds the ScriptHaus command. It will not pass a level 1-4 header, thematic break, or another code fence. Level 4 headers will be included as part of the help, level 1-3 headers will not.
Put global commands in a file named scripthaus.md
in your ScriptHaus home directory. Any command placed
there can be accessed easily using ^[command-name]
. Other files in your ScriptHaus home directory
can accessed as ^[md-file]::[command-name]
.
Put a scripthaus.md
file in your project root directory. When you are in that directory, or any
sub-directory, and command in that file can be accessed easily using .[command-name]
. Other sibling
files to the scripthaus.md file (which must be present) can be accessed using .[md-file]::[command-name]
.
By default commands are run in your current command-line directory (which may be a project sub-directory).
If you want commands to run with the project root set as the working directory, be sure to add the cd directive
# @scripthaus cd :playbook
to your commands.
It is located at $HOME/scripthaus
. It can be overridden by setting the $SCRIPTHAUS_HOME
environment variable.
Directives are special comments in your code that ScriptHaus parses to affect command execution. They always start as a language specific comment with @scripthaus as the first identifier, and the directive name as the 2nd. The rest of the line is the directive body.
The 'command' directive marks a code block as a scripthaus command (this directive is always necessary). It sets the command name. It can be followed by an optional " - " (white-space around the dash is necessary) to add a short description.
# @scripthaus command [command-name] - [short description]
The 'cd' directive will change the directory that the command runs in. It must be an absolute path (or one of the allowed special names). Normal shell path expansion is not run, except "~" will be expanded to your home directory.
# @scripthaus cd [directory]
# @scripthaus cd ~/Downloads
# ':playbook' means to set the current directory to the directory where this playbook lives
# @scripthaus cd :playbook
The 'nolog' directive turns off history logging for this command (unless it is explicitly overriden on the command-line using '--log'.
# @scripthaus nolog
Touch the file .nohistory
in your ScriptHaus home directory.
No, not yet. I'm working on a bash completion script.