[augeas-devel] [PATCH] Add a "time" node to make it easier to switch between "time" and

Raphael Pinson raphink at gmail.com
Fri Apr 10 16:19:16 UTC 2009


---
 lenses/cron.aug            |   10 ++++------
 lenses/tests/test_cron.aug |   38 +++++++++++++++++++-------------------
 2 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/lenses/cron.aug b/lenses/cron.aug
index 98e8cc9..56595f4 100644
--- a/lenses/cron.aug
+++ b/lenses/cron.aug
@@ -95,16 +95,14 @@ let dayofweek  = [ label "dayofweek"  . store alphanum ]
 (* View: user *)
 let user       = [ label "user"         . store Rx.word ]
 
-(* View: command *)
-let command    = [ label "command"      . store Rx.space_in ]
-
 
 (************************************************************************
  * View: time
  *   Time in the format "minute hour dayofmonth month dayofweek"
  *************************************************************************)
-let time        = minute . sep_spc . hour  . sep_spc . dayofmonth
-                         . sep_spc . month . sep_spc . dayofweek
+let time        = [ label "time" .
+                  minute . sep_spc . hour  . sep_spc . dayofmonth
+                         . sep_spc . month . sep_spc . dayofweek ]
 
 (* Variable: the valid values for schedules *)
 let schedule_re = "reboot" | "yearly" | "annually" | "monthly"
@@ -126,7 +124,7 @@ let schedule    = [ label "schedule" . Util.del_str "@"
 let entry       = [ label "entry" . indent
                    . ( time | schedule )
                    . sep_spc . user
-                   . sep_spc . command . eol ]
+                   . sep_spc . store Rx.space_in . eol ]
 
 
 (*
diff --git a/lenses/tests/test_cron.aug b/lenses/tests/test_cron.aug
index b4d380f..c62e436 100644
--- a/lenses/tests/test_cron.aug
+++ b/lenses/tests/test_cron.aug
@@ -16,24 +16,24 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
       { "SHELL" = "/bin/sh" }
       { "PATH"  = "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" }
       {}
-      { "entry"
-          { "minute"       = "30"   }
-          { "hour"         = "7"    }
-          { "dayofmonth"   = "*"    }
-          { "month"        = "*"    }
-          { "dayofweek"    = "*"    }
-          { "user"         = "root" }
-          { "command"      = "test -x /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null" } }
-      { "entry"
-          { "minute"       = "00"      }
-          { "hour"         = "*/3"     }
-          { "dayofmonth"   = "15-25/2" }
-          { "month"        = "May"     }
-          { "dayofweek"    = "1-5"     }
-          { "user"         = "user"    }
-          { "command"      = "somecommand" } }
+      { "entry" = "test -x /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null"
+          { "time"
+              { "minute"       = "30"   }
+              { "hour"         = "7"    }
+              { "dayofmonth"   = "*"    }
+              { "month"        = "*"    }
+              { "dayofweek"    = "*"    } }
+          { "user"         = "root" } }
+      { "entry" = "somecommand"
+          { "time"
+              { "minute"       = "00"      }
+              { "hour"         = "*/3"     }
+              { "dayofmonth"   = "15-25/2" }
+              { "month"        = "May"     }
+              { "dayofweek"    = "1-5"     } }
+          { "user"         = "user"    } }
       { "#comment" = "a comment" }
-      { "entry"
+      { "entry" = "a command"
           { "schedule"     = "yearly"  }
-          { "user"         = "foo"     }
-          { "command"      = "a command" } }
+          { "user"         = "foo"     } }
+          
-- 
1.5.6.3




More information about the augeas-devel mailing list