Installation
User installation
If you want to use Argbash locally, you have to download the software package and run the installation script.
Go to the release section of the GitHub project, choose the version to download, and download the source code package.
Unpack the contents of the archive. You can use the
bin/argbashscript without any installation (as it is described in the Quickstart), but you can proceed to the installation in order to be able to useargbashsystem-wide.Go to the
resourcesfolder. There is aMakefile.According to whether you have your
$HOME/.local/binfolder in thePATH:If so, run
make install PREFIX=$HOME/.local,else, run
sudo make install PREFIX=/usr.
Note
If you want multiple
Argbashversions installed in parallel, install them usingmake altinstall(and uninstall usingmake uninstall) commands. This will createargbash-X.Y.Zscript under thebindirectory, withargbash-X.Y,argbash-Xandargbashsymlinks pointing transitively to it. If you altinstall another version ofArgbash, the common symlinks will be overwritten (i.e. at leastargbash).This way of installation won’t install the
argbash-xtoymigration scripts.Optional:
Supply
INSTALL_COMPLETION=yesas an installation argument to install bash completion forargbashto$(SYSCONFDIR)/bash_completion.d. The defaultSYSCONFDIRis/etc, but you may override it in the same way as you can override thePREFIXvariable.To be able to let Argbash generate manpages, rst2man needs to be installed on your system. It’s part of the Python package docutils which can be installed on Debian/Ubuntu using
sudo apt install python3-docutils.Run some checks by executing:
make check(still in theresourcesfolder). You should get a messageAll is OKat the bottom.
Argbash has this audience:
Users — people that use scripts that make use of
Argbash.Developers — people that use
Argbashto write scripts.Tinkerers — people that come in contact with
Argbashinternals, typically curious Developers.bash >= 3.0— this is obvious, everybody needsbash. There is only one exception — in cases of simple scripts, aPOSIXshell s.a.dashwill be enough for Users.autoconf >= 2.63—Argbashis written in am4language extension calledm4sugar, which is contained inautoconf. Developers and Tinkerers need this.autoconfis available on Linux, macOS, BSDs and can be installed on MS Windows.grep,sed,coreutils— Theargbashscript usesgrep,sed,cat, andtest. If you haveautoconf, you probably have those already.GNU Make >= 4.0— the project uses Makefiles to perform a wide variety of tasks, although it is more of interest to Tinkerers.
Building Argbash
If you identify yourself as a tinkerer (i.e. you want to play with internals of Argbash), you may use a different set of steps:
Clone the Git repository:
git clone https://github.com/matejak/argbash.gitGo to the
resourcesdirectory consider running a develop install there, e.g.make develop PREFIX=$HOME/.local,This type of installation ensures that whenever you make a change to the
bin/argbashscript in the repository, theargbashcommand always calls thatbin/argbashscript.After you make modifications the source files (
.m4files in thesrcdirectory), you regeneratebin/argbashby runningmake ../bin/argbashin theresourcesdirectory.If you let a bug through that prevents the
argbashscript to regenerate itself, runmake bootstrapto regenerate it in a more robust way.Remember to run
make checkin theresourcesdirectory often to catch bugs as soon as possible.
Argbash components
The Argbash package consists of these scripts:
argbash, the main part ofArgbash. It is basically a wrapper around theautom4teutility that uses theArgbash“source code” located in thesrcdirectory. In course of an installation, both the script and the source are copied under the prefix — script goes to$PREFIX/binand source to$PREFIX/lib/argbash.The
argbashscript itself is generated usingArgbash. It can be (re)generated using a Makefile that can be found in theresourcesfolder.argbash-xtoyscripts (x,yare major version numbers) that assist users in modifying their scripts in case thatArgbashchanges its API. For example,Argbash 2.1.4(we sayArgbashof major version 2) hasargbash-1to2script andArgbashof major version 3 will have scriptsargbash-1to3andargbash-2to3.argbash-initis a quickstart script — it enables you to create a basic template for your script. Then, you just have to make some slight modifications, feed it to argbash and you are done.
The main Makefile
The Makefile in the resources folder can do many things:
Installation
make install [PREFIX=foo]runs the installation into the prefix you can specify (default is$(HOME)/.local). This will install theargbashscript (notice the missing.shextension) into$PREFIX/bin(and some support files into$PREFIX/lib/argbash).make develop [PREFIX=foo]is similar tomake install, but it installs a wrapper around the localbin/argbash, so any change to the file will be immediately reflected for everybody who uses the system-wide one. This is inspired by Python’spython setup.py developpattern.make uninstall [PREFIX=foo]inverse of the above.
Running argbash
make ../bin/argbash,make bootstrapmakes (or updates) theargbashscript (the script basically overwrites itself). Use the latter if previous update broke the current../bin/argbashso it is not able to regenerate itself.make examplescompiles examples from.m4files to.shfiles in theexamplesfolder.make foo/bar.shgenerates a script provided that there is afoo/bar.m4file.make foo/bar2.shgenerates a script provided that there is afoo/bar.shfile.
Releasing
make checkruns the tests.make version VERSION=1.0.0sets the project’s version to all corners of the project where it should go.make release [VERSION=1.0.0]refreshes date in theChangeLogand regenerates all of the stuff (and runs tests).make tagtags the version.