Commit Graph

21 Commits

Author SHA1 Message Date
stephan 17466452f0 revert __line for clean PR history 2022-07-28 17:53:41 +02:00
stephan 6243165645 add create and ifexists to line type 2022-07-28 16:27:12 +02:00
evilham c030deea3d [__line] Add support for '--state replace'
It is currently counter-intuitive that something like:

    # File '/thing' contents
    #SomeSetting WrongValue

    # Manifest
    __line '/thing' \
           --line 'SomeSeting GoodValue' \
           --regex '^(#[[:space:]]*)?SomeSetting[[:space:]]'

Produces:

    # Resulting '/thing' contents
    #SomeSetting WrongValue

This makes sense given the implementation, but it masks a very common use-case.

Changing the default behaviour for such a base type is not really an option, so
instead we add a `replace` as a valid value for `--state`, which would result
in:

    # Resulting '/thing' contents with: --state replace
    SomeSetting GoodValue

For compatibility, if the regex is missing, `--state replace` behaves just as
`--state present`.
2020-10-09 06:51:44 +02:00
Dennis Camera 5a9a1ba57f [__line] Produce error when file does not exist 2020-01-15 22:00:56 +01:00
Dennis Camera 629d0795c8 [__line] Always add line to end if anchor is not found 2020-01-15 17:27:25 +01:00
Dennis Camera 93ec4b46aa [__line] Ensure the line is only added once 2020-01-15 17:27:25 +01:00
ander 0f6fe4764b add --onchange to __line 2019-03-28 23:31:38 +02:00
Jonas Weber 6326eae1bb Fix SC2166 on all manfest/gencode/explorers 2018-10-01 22:13:24 +02:00
Steven Armstrong fb26894cbd when searching treat line as string, and regex as regexp
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2018-05-18 16:57:34 +02:00
Steven Armstrong a3968f8313 rewrite __line type for --before and --after support
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2018-05-18 01:25:35 +02:00
Darko Poljak 4f5dddd9d6
Fix for __line containing single quotes: #154. (#594) 2017-11-09 08:20:33 +01:00
tom 7ee56d099f resolved #444 add messaging to __line-type (#580)
#444 Add messaging to __line-type
2017-09-27 12:19:07 +02:00
Darko Poljak 62378dc8b9 Change shebang to #!/bin/sh -e 2017-06-28 13:19:32 +02:00
Steven Armstrong 2fdff153d6 dont fail if result is empty file
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2014-02-22 00:57:00 +01:00
Steven Armstrong 68c1bf6633 preserve ownership and permissions of existing file
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2014-02-22 00:56:54 +01:00
Nico Schottelius 51c9662475 DO NOT USE ECHO WHEN SOMETHING MAY CONTAIN A B-A-C-K-S-L-A-S-H
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2014-01-21 16:41:34 +01:00
Nico Schottelius f8c36c080e do not escape \ in --line
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2014-01-07 22:30:59 +01:00
Nico Schottelius 2932b8343f use printf instead of echo to avoid bash broken echo builtin
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-11-25 19:08:46 +01:00
Nico Schottelius 95513ab538 __line: handle fixed strings correctly, posix gave us -F -x for this case
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-10-29 12:23:07 +01:00
Nico Schottelius 2b66889105 __line: support line/regexp containing /
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-09-26 16:26:01 +02:00
Nico Schottelius 63573a9797 make package_data work
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-10-29 22:50:27 +01:00