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/argbash
script without any installation (as it is described in the Quickstart), but you can proceed to the installation in order to be able to useargbash
system-wide.Go to the
resources
folder. There is aMakefile
.According to whether you have your
$HOME/.local/bin
folder in thePATH
:- If so, run
make install PREFIX=$HOME/.local
, - else, run
sudo make install PREFIX=/usr
.
Note
If you want multiple
Argbash
versions installed in parallel, install them usingmake altinstall
(and uninstall usingmake uninstall
) commands. This will createargbash-X.Y.Z
script under thebin
directory, withargbash-X.Y
,argbash-X
andargbash
symlinks 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-xtoy
migration scripts.- If so, run
Optional:
- Supply
INSTALL_COMPLETION=yes
as an installation argument to install bash completion forargbash
to$(SYSCONFDIR)/bash_completion.d
. The defaultSYSCONFDIR
is/etc
, but you may override it in the same way as you can override thePREFIX
variable. - 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 theresources
folder). You should get a messageAll is OK
at the bottom.
- Supply
Argbash
has this audience:
- Users — people that use scripts that make use of
Argbash
. - Developers — people that use
Argbash
to write scripts. - Tinkerers — people that come in contact with
Argbash
internals, typically curious Developers. bash >= 3.0
— this is obvious, everybody needsbash
. There is only one exception — in cases of simple scripts, aPOSIX
shell s.a.dash
will be enough for Users.autoconf >= 2.63
—Argbash
is written in am4
language extension calledm4sugar
, which is contained inautoconf
. Developers and Tinkerers need this.autoconf
is available on Linux, macOS, BSDs and can be installed on MS Windows.grep
,sed
,coreutils
— Theargbash
script 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.git
Go to the
resources
directory 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/argbash
script in the repository, theargbash
command always calls thatbin/argbash
script.After you make modifications the source files (
.m4
files in thesrc
directory), you regeneratebin/argbash
by runningmake ../bin/argbash
in theresources
directory.If you let a bug through that prevents the
argbash
script to regenerate itself, runmake bootstrap
to regenerate it in a more robust way.Remember to run
make check
in theresources
directory 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 theautom4te
utility that uses theArgbash
“source code” located in thesrc
directory. In course of an installation, both the script and the source are copied under the prefix — script goes to$PREFIX/bin
and source to$PREFIX/lib/argbash
.The
argbash
script itself is generated usingArgbash
. It can be (re)generated using a Makefile that can be found in theresources
folder.argbash-xtoy
scripts (x
,y
are major version numbers) that assist users in modifying their scripts in case thatArgbash
changes its API. For example,Argbash 2.1.4
(we sayArgbash
of major version 2) hasargbash-1to2
script andArgbash
of major version 3 will have scriptsargbash-1to3
andargbash-2to3
.argbash-init
is 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 theargbash
script (notice the missing.sh
extension) 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 develop
pattern.make uninstall [PREFIX=foo]
inverse of the above.
Running argbash¶
make ../bin/argbash
,make bootstrap
makes (or updates) theargbash
script (the script basically overwrites itself). Use the latter if previous update broke the current../bin/argbash
so it is not able to regenerate itself.make examples
compiles examples from.m4
files to.sh
files in theexamples
folder.make foo/bar.sh
generates a script provided that there is afoo/bar.m4
file.make foo/bar2.sh
generates a script provided that there is afoo/bar.sh
file.
Releasing¶
make check
runs the tests.make version VERSION=1.0.0
sets the project’s version to all corners of the project where it should go.make release [VERSION=1.0.0]
refreshes date in theChangeLog
and regenerates all of the stuff (and runs tests).make tag
tags the version.