forked from hummypkg/sweeper
add %format() and log
This commit is contained in:
parent
3a6386c2d2
commit
2a15e1b6d6
@ -1,7 +1,7 @@
|
||||
Package: sweeper
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 2.0.13-1
|
||||
Version: 2.0.14
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif(>=1.2.5)
|
||||
|
@ -38,6 +38,7 @@ set ::sweeper::expand_fns {
|
||||
replace {2}
|
||||
regsub {2}
|
||||
asfilename {1 {inline}}
|
||||
format {2 {inline}}
|
||||
}
|
||||
|
||||
proc ::sweeper::expand_replace {ts &ret search replace} {
|
||||
@ -56,6 +57,14 @@ proc ::sweeper::expand_asfilename {ts &ret arg} {
|
||||
return [system filename $arg]
|
||||
}
|
||||
|
||||
proc ::sweeper::expand_format {ts &ret format arg} {
|
||||
if {[catch {set r [format $format $arg]} msg]} {
|
||||
log "Error. %format - $msg"
|
||||
return "!FORMAT-ERROR!"
|
||||
}
|
||||
return $r
|
||||
}
|
||||
|
||||
# Expand a string containing tokens
|
||||
proc ::sweeper::expand {ts str {orig ""}} {
|
||||
if {[string first "%" $str] == -1} {
|
||||
@ -759,6 +768,17 @@ proc ::sweeper::action_delete {ts cmd arg folder} {
|
||||
return 1
|
||||
}
|
||||
|
||||
proc ::sweeper::action_log {ts cmd arg folder} {
|
||||
if {$folder} {
|
||||
::sweeper::folder_apply [$ts dir] \
|
||||
::sweeper::action_log $cmd $arg 0
|
||||
return 0
|
||||
}
|
||||
set arg [::sweeper::expand $ts $arg]
|
||||
log "LOG: '$arg'" 0
|
||||
return 0
|
||||
}
|
||||
|
||||
proc ::sweeper::action_flag {ts cmd arg folder} {
|
||||
log "Flagged [$ts get file] as $arg" 0
|
||||
if {!$::sweeper::dryrun} {
|
||||
|
@ -330,7 +330,13 @@ var schema = {
|
||||
argtype: 'none',
|
||||
desc: 'Delete recording',
|
||||
continues: false
|
||||
}
|
||||
},
|
||||
'log': {
|
||||
'class': 'all',
|
||||
argtype: 'string',
|
||||
desc: 'Log...',
|
||||
continues: true
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user