Skip to content

Commit 00633b1

Browse files
committed
Add a command line argument for the currency symbol in the cocomo project cost estimation.
1 parent b458dee commit 00633b1

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ func main() {
294294
"",
295295
"inspect every file and remap by checking for a string and remapping the language [e.g. \"-*- C++ -*-\":\"C Header\"]",
296296
)
297+
flags.StringVar(
298+
&processor.CurrencySymbol,
299+
"currency-symbol",
300+
"$",
301+
"set currency symbol",
302+
)
297303

298304
if err := rootCmd.Execute(); err != nil {
299305
os.Exit(1)

processor/formatters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ func calculateCocomo(sumCode int64, str *strings.Builder) {
998998

999999
p := gmessage.NewPrinter(glang.English)
10001000

1001-
str.WriteString(p.Sprintf("Estimated Cost to Develop (%s) $%d\n", CocomoProjectType, int64(estimatedCost)))
1001+
str.WriteString(p.Sprintf("Estimated Cost to Develop (%s) %s%d\n", CocomoProjectType, CurrencySymbol, int64(estimatedCost)))
10021002
str.WriteString(fmt.Sprintf("Estimated Schedule Effort (%s) %f months\n", CocomoProjectType, estimatedScheduleMonths))
10031003
if math.IsNaN(estimatedPeopleRequired) {
10041004
str.WriteString(fmt.Sprintf("Estimated People Required 1 Grandparent\n"))

processor/processor.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ var RemapUnknown = ""
118118
// RemapAll allows remapping of all files with a string to search the content for
119119
var RemapAll = ""
120120

121+
// CurrencySymbol allows setting the currency symbol for cocomo project cost estimation
122+
var CurrencySymbol = ""
123+
121124
// FileOutput sets the file that output should be written to
122125
var FileOutput = ""
123126

0 commit comments

Comments
 (0)