Hi Antoine,

> This package, like all of mine, is LowNMU so upload whenever you feel
> ready.

OK, thanks!

> > ++          sed '1s/^-m \{0,1\}//' >"$logfile" <<-EOF
> > ++                  $*
> > ++          EOF
> 
> ... isn't there a simpler way than piping this through sed?

I’ve wondered about this. There are several ways, for example
involving printf(1) and manipulating $1 in shell, but they all
amount to more code and not better either.

> does that regex really do the same as ${@#-m}? it seems there's some
> whitespace and anchoring stuff going on here that would subtly change
> behavior...

${@#-m} is not specified what it does. The intent of the patch is
to remove either '-m' as first parameter or the leading '-m' from
the first parameter, then concatenate all parameters and write
them into the logfile.

What my code does is: first concatenate. This uses the first byte
in $IFS, which is a space, so we have '$*' expand to '$1 $2 $3 …'
(of course no spaces if the next parameters are not set). Then it
strips a leading either '-m' (second case above) or '-m ' (first
case above: -m as a parameter of its own) from *ONLY* the first
line.

Consider this:

etckeeper commit -m 'foo bar
-mbaz'

The user clearly expects the second line to start with “-m”.

Use of a here document instead of echo also fixes the following:

etckeeper commit -m -n foo

etckeeper commit -m -c foo

etckeeper commit -m 'foo\tbar'

(The behaviour of echo(1) is also not specified, or rather,
implementation-defined, if the arguments start with a hyphen-minus
or contain a backslash.)

> https://etckeeper.branchable.com/todo/

This seems to be a static page? I don’t find out how to do that.

> Let me know if you want me to carry that for you.

That would be great, thanks!

bye,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

**********

Mit der tarent Academy bieten wir auch Trainings und Schulungen in den
Bereichen Softwareentwicklung, Agiles Arbeiten und Zukunftstechnologien an.

Besuchen Sie uns auf www.tarent.de/academy. Wir freuen uns auf Ihren Kontakt.

**********

Reply via email to