Commit 7688b13e499d4a693d68f34b814966e4e3bda705
1 parent
677db2974e
Exists in
master
Ajout de l'option print dans wize.rb
Showing 1 changed file with 23 additions and 2 deletions Side-by-side Diff
wize.rb
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | opts.separator "" |
| 23 | 23 | whatIDo = <<-AFP |
| 24 | 24 | |
| 25 | - liste ou applique une configuartion de template wize pour zim | |
| 25 | + liste ou applique une configuration de template wize pour zim | |
| 26 | 26 | |
| 27 | 27 | AFP |
| 28 | 28 | |
| ... | ... | @@ -31,7 +31,9 @@ |
| 31 | 31 | opts.on("-i", |
| 32 | 32 | "--install", |
| 33 | 33 | "modifie le fichier Wize_Print.html en remplaçant", |
| 34 | - "%%HOME%% par la valeur de $HOME") do |l| | |
| 34 | + "%%HOME%% par la valeur de $HOME. Installe également", | |
| 35 | + "un lien symbolique dans le dossier de config de zim.", | |
| 36 | + "A éxécuter une seule fois a priori.") do |l| | |
| 35 | 37 | options[:install] = l |
| 36 | 38 | end |
| 37 | 39 | |
| ... | ... | @@ -41,6 +43,12 @@ |
| 41 | 43 | options[:list] = l |
| 42 | 44 | end |
| 43 | 45 | |
| 46 | + opts.on("-p", | |
| 47 | + "--print", | |
| 48 | + "Affiche la configuration actuelle") do |p| | |
| 49 | + options[:print] = p | |
| 50 | + end | |
| 51 | + | |
| 44 | 52 | opts.on("-a", |
| 45 | 53 | "--apply CONF", |
| 46 | 54 | "applique la config CONF") do |conf| |
| ... | ... | @@ -82,6 +90,13 @@ |
| 82 | 90 | names |
| 83 | 91 | end |
| 84 | 92 | |
| 93 | +# Get the current config by looking at print-common | |
| 94 | +def getCurrent | |
| 95 | + Dir.chdir($zimHtmlTemplateDir) | |
| 96 | + File.readlink("print-common") =~ /^common-(.+)$/ | |
| 97 | + $1 | |
| 98 | +end | |
| 99 | + | |
| 85 | 100 | # Apply a config |
| 86 | 101 | def applyConfig(name) |
| 87 | 102 | Dir.chdir($zimHtmlTemplateDir) |
| ... | ... | @@ -215,6 +230,12 @@ |
| 215 | 230 | configs.each { |c| |
| 216 | 231 | puts c |
| 217 | 232 | } |
| 233 | + exit | |
| 234 | +end | |
| 235 | + | |
| 236 | ||
| 237 | +if options[:print] | |
| 238 | + puts getCurrent | |
| 218 | 239 | exit |
| 219 | 240 | end |
| 220 | 241 |