Ver código fonte

ajout du nom de la tâche en parametre

nas 3 anos atrás
pai
commit
89879ef6e9
1 arquivos alterados com 18 adições e 14 exclusões
  1. 18
    14
      pert

+ 18
- 14
pert Ver arquivo

21
 {
21
 {
22
     _echo ""
22
     _echo ""
23
     _echoB "A command line PERT calculator for quick estimates."
23
     _echoB "A command line PERT calculator for quick estimates."
24
-    _echo "Comma separated task list in the form \"1,2,12 4,5,9 2,3,6\", where whitespace separates tasks."
24
+    _echo "Comma separated task list in the form \"one,1,2,12 two,4,5,9 three,2,3,6\", where whitespace separates tasks."
25
     _echo ""
25
     _echo ""
26
     _echoB "Usage:"
26
     _echoB "Usage:"
27
-    _echo "\tpert [optimistic,realistic,pessimistic]"
27
+    _echo "\tpert [name,optimistic,realistic,pessimistic]"
28
     _echo ""
28
     _echo ""
29
     _echoB "Example:"
29
     _echoB "Example:"
30
-    _echo "\tpert 1,3,4"
31
-    _echo "\tpert 10,15,20 5,7,10"
32
-    _echo "\tpert \"1,2,3\" \"15,17,20\""
30
+    _echo "\tpert one,1,3,4"
31
+    _echo "\tpert one,10,15,20 two,5,7,10"
32
+    _echo "\tpert \"one,1,2,3\" \"two,15,17,20\""
33
     _echo ""
33
     _echo ""
34
 }
34
 }
35
 
35
 
51
 function _header
51
 function _header
52
 {
52
 {
53
     _echo ""
53
     _echo ""
54
-    _echoB "Tasks"
54
+    _echoB "Task"
55
     _echo ""
55
     _echo ""
56
     _divider
56
     _divider
57
     printf "$format" "#" "optimistic" "realistic" "pessimistic" "duration" "risk" "variance"
57
     printf "$format" "#" "optimistic" "realistic" "pessimistic" "duration" "risk" "variance"
75
 
75
 
76
         # split values
76
         # split values
77
         IFS=',' read -ra ADDR <<< "$var"
77
         IFS=',' read -ra ADDR <<< "$var"
78
+o="0"
79
+        if [ -n "${ADDR[0]-}" ]; then
80
+            t=${ADDR[0]}
81
+        fi
78
 
82
 
79
         # optimistic value
83
         # optimistic value
80
         o="0"
84
         o="0"
81
-        if [ -n "${ADDR[0]-}" ]; then
82
-            o=${ADDR[0]}
85
+        if [ -n "${ADDR[1]-}" ]; then
86
+            o=${ADDR[1]}
83
         fi
87
         fi
84
 
88
 
85
         # realistic value
89
         # realistic value
86
         r="0"
90
         r="0"
87
-        if [ -n "${ADDR[1]-}" ]; then
88
-            r=${ADDR[1]}
91
+        if [ -n "${ADDR[2]-}" ]; then
92
+            r=${ADDR[2]}
89
         fi
93
         fi
90
 
94
 
91
         # pessimistic value
95
         # pessimistic value
92
         p="0"
96
         p="0"
93
-        if [ -n "${ADDR[2]-}" ]; then
94
-            p=${ADDR[2]}
97
+        if [ -n "${ADDR[3]-}" ]; then
98
+            p=${ADDR[3]}
95
         fi
99
         fi
96
 
100
 
97
         # check values
101
         # check values
98
         if [ -z "$o" ] || [ -z "$r" ] || [ -z "$p" ]; then
102
         if [ -z "$o" ] || [ -z "$r" ] || [ -z "$p" ]; then
99
-            printf "$format" "$counter. bad input" $o $r $p
103
+            printf "$format" "$counter. bad input" $t $o $r $p
100
         else
104
         else
101
 
105
 
102
             # pert estimate
106
             # pert estimate
112
             total_variance=$(_calc "$total_variance + $variance")
116
             total_variance=$(_calc "$total_variance + $variance")
113
 
117
 
114
             # row
118
             # row
115
-            printf "$format" "$counter. task" $o $r $p $pert_estimate $standard_deviation $variance
119
+            printf "$format" "$counter."$t $o $r $p $pert_estimate $standard_deviation $variance
116
         fi
120
         fi
117
 
121
 
118
     done
122
     done

Carregando…
Cancelar
Salvar