- Base library:

- Rename default.bash to base.bash,
    - Normalise some function names: version_print(), help_print(), str_quote(), str_escape(), echo_line(), echo_error() & cmd_exec()
    - Normalise some global variables: VERBOSE & DRY_RUN,
    - Add default options: errexit, pipefail & nounset,
    - Add GPL headers,
- ISL:
    - Move ISL functions to isl command,
    - Add bsh completion.
This commit is contained in:
2026-03-28 17:54:27 +01:00
parent 97c05c4606
commit 83c1014c66
11 changed files with 786 additions and 245 deletions

53
etc/bash_completion.d/isl Normal file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
#!/bin/bash
#-----------------------------------------------------------------------------------------------------------------------------------
#
# ISL: Image Stack Log
#
# Copyright (C) 2026 Arnaud G. GIBERT
# mailto:arnaud@rx3.net
#
# This is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; If not, see
# <https://www.gnu.org/licenses/>.
#
#-----------------------------------------------------------------------------------------------------------------------------------
# -*- mode: shell; sh-basic-offset: 4; indent-tabs-mode: nil; -*-
_isl() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--help -h --version -V --test -T --verbose -v --add -a --cat -c --dump -d --top -t --reverse -r --inline -i --image -m"
# Top-level options
case "${prev}" in
--add|-a)
COMPREPLY=( $(compgen -f -- "${cur}") ) # Complete with filenames/URLs
return 0
;;
--cat|-c|--dump|-d|--top|-t)
# These options don't take arguments
COMPREPLY=()
return 0
;;
*)
# Default completion: show all top-level options
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _isl isl

View File

@@ -1,5 +1,29 @@
#!/bin/bash
#-----------------------------------------------------------------------------------------------------------------------------------
#
# Rx3 Base Profile
#
# Copyright (C) 2000-2026 Arnaud G. GIBERT
# mailto:arnaud@rx3.net
#
# This is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; If not, see
# <https://www.gnu.org/licenses/>.
#
#-----------------------------------------------------------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------
# Global Variable
#-----------------------------------------------------------------------------------------------------------------------------------
@@ -11,6 +35,7 @@ export EDITOR=emacs
#-----------------------------------------------------------------------------------------------------------------------------------
# CatVal
#-----------------------------------------------------------------------------------------------------------------------------------
@@ -29,29 +54,7 @@ export -f cateval
# Print
#-----------------------------------------------------------------------------------------------------------------------------------
print()
{
if [[ "$1" == "-i" ]]
then
shift
str="%s"'\\n'
else
str="%s"'\n'
fi
printf "${str}" "$*"
}
export -f print
# File Enable
#-----------------------------------------------------------------------------------------------------------------------------------
@@ -81,15 +84,17 @@ export -f file_enable
#-----------------------------------------------------------------------------------------------------------------------------------
# Include
#-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/isl.bash
# None
#-----------------------------------------------------------------------------------------------------------------------------------
# Aliases
#-----------------------------------------------------------------------------------------------------------------------------------