Skip to content

Commit

Permalink
crontab: minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Jan 31, 2024
1 parent dee2bf9 commit 2f57d36
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions extra/crontab/crontab.factor
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ TUPLE: cronentry minutes hours days months days-of-week command ;

:: parse-value ( value quot: ( value -- value' ) seq -- value )
value {
{ [ dup "*" = ] [ drop seq ] }
{ [ CHAR: , over member? ] [
"," split [ quot seq parse-value ] map concat ] }
{ [ dup "*" = ] [ drop seq ] }
{ [ CHAR: / over member? ] [
"/" split1 [
quot seq parse-value
dup length 1 = [ seq swap first seq first - ] [ 0 ] if
over length dup 7 = [ [ <circular> ] 2dip ] [ 1 - ] if
quot seq parse-value dup length 1 =
[ seq swap first seq index seq length ]
[ 0 over length ] if 1 -
] dip string>number <range> swap nths ] }
{ [ CHAR: - over member? ] [
"-" split1 quot seq parse-range [a..b] ] }
Expand Down Expand Up @@ -80,7 +80,7 @@ PRIVATE>
[ [ string>number ] T{ range f 0 24 1 } parse-value ]
[ [ string>number ] T{ range f 1 31 1 } parse-value ]
[ [ parse-month ] T{ range f 1 12 1 } parse-value ]
[ [ parse-day ] T{ range f 0 7 1 } parse-value ]
[ [ parse-day ] T{ circular f T{ range f 0 7 1 } 1 } parse-value ]
[ ]
} spread cronentry boa check-cronentry ;

Expand Down

0 comments on commit 2f57d36

Please sign in to comment.