File: 03_start.diff

package info (click to toggle)
stopwatch 3.5-3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 176 kB
  • sloc: tcl: 1,026; makefile: 27
file content (36 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Adds options -forward and -backward to start stopwatch with timer on.
Patch by Carles Pina i Estany <carles@pina.cat>.  Closes: #507507.  

--- /usr/bin/stopwatch	2008-07-02 13:13:46.000000000 +0200
+++ ./stopwatch	2008-12-06 01:40:38.815444276 +0100
@@ -392,6 +392,14 @@
 
 "
 
+    .help.text insert end "Command line arguments" h1
+    .help.text insert end "
+
+-forward: executes stopwatcher with the timer on
+-backward TIME: executes stopwatch with the timer on, backward, with initial TIME as time (same format than stopwatch GUI)
+
+"
+
     .help.text insert end "Caveats" h1
     .help.text insert end {
 
@@ -471,4 +479,15 @@
 bind all <z> {.lapzero      invoke} ; bind all <Control-z> {lapzr}
 bind all <Z> {.totalzero    invoke} ; bind all <Control-Z> {totalzr}
 
+set option_location [lsearch $argv "-forward"]
+if { $option_location >= 0 } {
+    start
+}
+
+set option_location [lsearch $argv "-backward"]
+if { $option_location >= 0 } {
+    set time(total) [lindex $argv [expr {$option_location+1}]]
+    set time(forward) 0
+    start
+}