Skip to content

Commit

Permalink
Tmpfiles: allow minus sign for letter types
Browse files Browse the repository at this point in the history
Allow the minus sign at the end of a type specification, indicating that
a failure in executing that line is ignored.
  • Loading branch information
ptoscano committed Sep 17, 2020
1 parent c57d27a commit 2edcd18
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
20 changes: 20 additions & 0 deletions lenses/tests/test_tmpfiles.aug
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ Tree for <exclamation_mark> *)
{ "argument" = "-" }
}

(* Variable: minus
Example with an minus mark in the type *)
let minus = "D- /tmp/foo - - - - -\n"

(* Variable: minus_tree
Tree for <minus_tree> *)
let minus_tree =
{
"1"
{ "type" = "D-" }
{ "path" = "/tmp/foo" }
{ "mode" = "-" }
{ "uid" = "-" }
{ "gid" = "-" }
{ "age" = "-" }
{ "argument" = "-" }
}

(* Variable: short
Example with only type and path *)
let short = "A+ /tmp/foo\n"
Expand Down Expand Up @@ -357,6 +375,8 @@ Invalid example that contain invalid mode (letter) *)

test Tmpfiles.lns get exclamation_mark = exclamation_mark_tree

test Tmpfiles.lns get minus = minus_tree

test Tmpfiles.lns get short = short_tree

test Tmpfiles.lns get short_mode = short_mode_tree
Expand Down
5 changes: 3 additions & 2 deletions lenses/tmpfiles.aug
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ Empty lines *)
(* Group: Lense-specific primitives *)

(* View: type
One letter. Some of them can have a "+" and all can have a "!".
One letter. Some of them can have a "+" and all can have an
exclamation mark ("!") and/or minus sign ("-").

Not all letters are valid.
*)
let type = /([fFwdDevqQpLcbCxXrRzZtThHaAm]|[fFwpLcbaA]\+)!?/
let type = /([fFwdDevqQpLcbCxXrRzZtThHaAm]|[fFwpLcbaA]\+)!?-?/

(* View: mode
"-", or 3-4 bytes. Optionally starts with a "~". *)
Expand Down

0 comments on commit 2edcd18

Please sign in to comment.