gsu.git
9 years agogsu: Avoid duplication of command regex.
Andre Noll [Tue, 2 Aug 2011 13:09:21 +0000 (15:09 +0200)]
gsu: Avoid duplication of command regex.

The regular expression for fining the subcommands was duplicated
four times in gsu. Needless to say that this resulted in more than
one variant of the expression...

Avoid this duplication by introducing the global gsu_command_regex
variable. While at it, use a more clever sed command in
_gsu_available_commands() which allows to kill a grep command.

9 years agogsu: Set copyright year to 2011.
Andre Noll [Tue, 2 Aug 2011 12:42:22 +0000 (14:42 +0200)]
gsu: Set copyright year to 2011.

9 years agogsu: Fix handling of config options with newlines.
Andre Noll [Sun, 27 Mar 2011 09:49:35 +0000 (11:49 +0200)]
gsu: Fix handling of config options with newlines.

Without this, newlines are transformed into spaces.

9 years agogsu: Don't use the =~ operator.
Andre Noll [Thu, 25 Nov 2010 16:36:23 +0000 (17:36 +0100)]
gsu: Don't use the =~ operator.

I need it at least on one machine that still has only bash-2.

9 years agogsu_getopts: Abort on programming errors and add documentation.
Andre Noll [Sun, 24 Oct 2010 09:59:46 +0000 (11:59 +0200)]
gsu_getopts: Abort on programming errors and add documentation.

9 years agogsu: Introduce gsu_getopts().
Andre Noll [Sun, 24 Oct 2010 09:28:23 +0000 (11:28 +0200)]
gsu: Introduce gsu_getopts().

No users yet.

9 years agogsu: Remove check on bash version.
Andre Noll [Fri, 15 Oct 2010 16:20:18 +0000 (18:20 +0200)]
gsu: Remove check on bash version.

It hurts more than the possible incompatibilities.

9 years agogsu: com_prefs -e fixes.
Andre Noll [Sun, 10 Oct 2010 09:12:51 +0000 (11:12 +0200)]
gsu: com_prefs -e fixes.

Create the subdirectory for the config file if it does not exist, and fix the
return value for the editor command.

9 years agogsu: Kill some unused error codes.
Andre Noll [Sat, 25 Sep 2010 17:28:45 +0000 (19:28 +0200)]
gsu: Kill some unused error codes.

9 years agogsu: Add -e option to com_prefs.
Andre Noll [Mon, 13 Sep 2010 03:30:36 +0000 (05:30 +0200)]
gsu: Add -e option to com_prefs.

9 years agogsu: Minor cosmetic cleanup.
Andre Noll [Mon, 13 Sep 2010 03:30:18 +0000 (05:30 +0200)]
gsu: Minor cosmetic cleanup.

9 years agogsu com_help(): Be more strict when looking for command documentation.
Andre Noll [Mon, 30 Aug 2010 21:52:07 +0000 (23:52 +0200)]
gsu com_help(): Be more strict when looking for command documentation.

9 years agoChange name of internal commands.
Andre Noll [Mon, 30 Aug 2010 16:28:52 +0000 (18:28 +0200)]
Change name of internal commands.

These are not meant to be called from elsewhere, so mark them with an
underscore. Also fix the indentation of the com_help() code.

9 years agogsu: Error out if not running as bash-4.
Andre Noll [Sat, 25 Sep 2010 16:56:25 +0000 (18:56 +0200)]
gsu: Error out if not running as bash-4.

9 years agogsu: Change semantics of gsu_check_arg_count().
Andre Noll [Sun, 18 Jul 2010 13:30:18 +0000 (15:30 +0200)]
gsu: Change semantics of gsu_check_arg_count().

It's kind of ugly having to specify an artificial upper bound on the arg count
if the allowed number of arguments is unlimited.

9 years agogtt: The git topic tool.
Andre Noll [Fri, 4 Jun 2010 16:17:55 +0000 (18:17 +0200)]
gtt: The git topic tool.

Another gsu-based script for managing git topic branches.

9 years agogsu: Add gsu_check_arg_count().
Andre Noll [Mon, 21 Jun 2010 14:29:20 +0000 (16:29 +0200)]
gsu: Add gsu_check_arg_count().

This function is open-coded $MANY times, so it makes sense to
have one globally visible function that can be called from all
scripts that use gsu.

9 years agogsu: Print the name of the invalid config variable on errors.
Andre Noll [Sun, 13 Jun 2010 23:46:21 +0000 (01:46 +0200)]
gsu: Print the name of the invalid config variable on errors.

9 years agogsu: Fix quoting for multi-line variables.
Andre Noll [Mon, 5 Apr 2010 16:29:14 +0000 (18:29 +0200)]
gsu: Fix quoting for multi-line variables.

The new para_adm topics command triggered this bug.

9 years agogsu: Fix com_prefs() for invalid preferences.
Andre Noll [Thu, 25 Mar 2010 14:23:25 +0000 (15:23 +0100)]
gsu: Fix com_prefs() for invalid preferences.

The prefs command would print only empty values for
all options that come after an invalid option.
Refuse to execute com_prefs() in this case is the most
simple fix.

9 years agogsu: Make command line vars trump config file vars.
Andre Noll [Tue, 2 Mar 2010 15:00:23 +0000 (16:00 +0100)]
gsu: Make command line vars trump config file vars.

This allows to overrule preferences  given in the config file by
using command line like this

lv=foo snapfsck

which ignores the setting of lv in ~/.snapfsck.rc and uses the value
"foo" instead.

9 years agogsu: Print help text on prefs command.
Andre Noll [Tue, 2 Mar 2010 14:56:50 +0000 (15:56 +0100)]
gsu: Print help text on prefs command.

This uses another nice bashism I recently learned.

9 years agogsu: Use bash shebang.
Andre Noll [Tue, 2 Mar 2010 14:55:32 +0000 (15:55 +0100)]
gsu: Use bash shebang.

It's kind of pointless trying to be portable here.

9 years agogsu: Allow help/man/prefs command even on invalid configs.
Andre Noll [Fri, 21 Aug 2009 15:20:39 +0000 (17:20 +0200)]
gsu: Allow help/man/prefs command even on invalid configs.

These generic subcommands do not need the config file. It's pointless
to refuse to print the help e.g. if a required config variable is unset.

Also, use the name of the executable as the default value for gsu_name.

9 years agogsu: Introduce gsu_config_var_prefix.
Andre Noll [Fri, 19 Jun 2009 09:25:27 +0000 (11:25 +0200)]
gsu: Introduce gsu_config_var_prefix.

It defaults to the $gsu_name, i.e. this is a backwards-compatible change.

9 years agogsu: Fix a typo in gsu_check_options().
Andre Noll [Fri, 19 Jun 2009 09:24:38 +0000 (11:24 +0200)]
gsu: Fix a typo in gsu_check_options().

This caused gsu to exit without an error message in case there is
an invalid option type given in the script that used gsu.

9 years agogsu: Allow empty default values.
Andre Noll [Fri, 12 Jun 2009 11:33:24 +0000 (13:33 +0200)]
gsu: Allow empty default values.

9 years agoPriliminary version of gsu2.
Andre Noll [Wed, 10 Jun 2009 14:48:47 +0000 (16:48 +0200)]
Priliminary version of gsu2.

Backwards compatible, new features are only used by dpch yet.

9 years agogsu improvements.
Andre Noll [Fri, 3 Apr 2009 08:45:53 +0000 (10:45 +0200)]
gsu improvements.

Support config files from within gsu. Untested.

9 years agogsu: Remove unused variable "tilde_signs".
Andre Noll [Sun, 26 Aug 2007 22:15:53 +0000 (00:15 +0200)]
gsu: Remove unused variable "tilde_signs".

9 years agogsu: Make man a generic gsu command.
Andre Noll [Sun, 26 Aug 2007 21:07:14 +0000 (23:07 +0200)]
gsu: Make man a generic gsu command.

Also, make the help text of eat grutatxt-friendly and add some more
documentation.

9 years agogsu: Kill debug "ret=1".
Andre Noll [Sat, 25 Aug 2007 19:00:25 +0000 (21:00 +0200)]
gsu: Kill debug "ret=1".

9 years agogsu: Replace "$*" by "$@".
Andre Noll [Fri, 24 Aug 2007 17:06:30 +0000 (19:06 +0200)]
gsu: Replace "$*" by "$@".

This allows to pass parameters containing spaces.

9 years agogsu: Trivial gsu_err_msg() cleanup.
Andre Noll [Wed, 1 Aug 2007 15:09:07 +0000 (17:09 +0200)]
gsu: Trivial gsu_err_msg() cleanup.

9 years agogsu: Fix two bashisms.
Andre Noll [Thu, 26 Jul 2007 13:40:42 +0000 (15:40 +0200)]
gsu: Fix two bashisms.

Always include the '$', even in math expressions where bash doesn't
need it.

9 years agogsu: Fix "echo -en" bashism.
Andre Noll [Thu, 26 Jul 2007 13:15:37 +0000 (15:15 +0200)]
gsu: Fix "echo -en" bashism.

9 years agogsu: trivial cleanup.
Andre Noll [Fri, 13 Jul 2007 17:06:50 +0000 (19:06 +0200)]
gsu: trivial cleanup.

9 years agogsu: remove shebang
Andre Noll [Wed, 11 Jul 2007 14:59:48 +0000 (16:59 +0200)]
gsu: remove shebang

It's not needed for functions.

9 years agogsu: print $(basename $0) instead of $0 on help output.
Andre Noll [Wed, 11 Jul 2007 13:33:07 +0000 (15:33 +0200)]
gsu: print $(basename $0) instead of $0 on help output.

9 years agointroduce gsu: The global subcommand utility, and make bbf_adm use it.
Andre Noll [Wed, 11 Jul 2007 09:34:43 +0000 (11:34 +0200)]
introduce gsu: The global subcommand utility, and make bbf_adm use it.

18 years agoeat: the environment admin tool
Andre [Tue, 21 Feb 2006 17:20:09 +0000 (18:20 +0100)]
eat: the environment admin tool

It is no good sign if one has written so many scripts that
a tool for managing them is neccessary..