morpheus-cli 4.2.15 → 4.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/cli/cli_command.rb +84 -4
- data/lib/morpheus/cli/cli_registry.rb +3 -0
- data/lib/morpheus/cli/commands/standard/benchmark_command.rb +16 -13
- data/lib/morpheus/cli/invoices_command.rb +323 -221
- data/lib/morpheus/cli/library_option_lists_command.rb +61 -125
- data/lib/morpheus/cli/library_option_types_command.rb +14 -9
- data/lib/morpheus/cli/mixins/library_helper.rb +32 -0
- data/lib/morpheus/cli/mixins/print_helper.rb +39 -10
- data/lib/morpheus/cli/option_types.rb +15 -4
- data/lib/morpheus/cli/price_sets_command.rb +1 -1
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/formatters.rb +7 -19
- metadata +2 -2
@@ -461,7 +461,7 @@ class Morpheus::Cli::PriceSetsCommand
|
|
461
461
|
private
|
462
462
|
|
463
463
|
def currency_sym(currency)
|
464
|
-
Money::Currency.new((currency
|
464
|
+
Money::Currency.new((currency.to_s != '' ? currency : 'usd').to_sym).symbol
|
465
465
|
end
|
466
466
|
|
467
467
|
def price_prefix(price)
|
data/lib/morpheus/cli/version.rb
CHANGED
data/lib/morpheus/formatters.rb
CHANGED
@@ -365,14 +365,8 @@ def format_number(n, opts={})
|
|
365
365
|
return out
|
366
366
|
end
|
367
367
|
|
368
|
-
def format_sig_dig(n,
|
369
|
-
|
370
|
-
parts = n.to_f.round(sig_dig).to_s.split(".")
|
371
|
-
if parts.size > 1 && sig_dig
|
372
|
-
parts[1] = parts[1].ljust(sig_dig, "0")
|
373
|
-
end
|
374
|
-
out << parts.join(".")
|
375
|
-
return out
|
368
|
+
def format_sig_dig(n, sigdig=3)
|
369
|
+
sprintf("%.#{sigdig}f", n)
|
376
370
|
end
|
377
371
|
|
378
372
|
def currency_sym(currency)
|
@@ -382,22 +376,16 @@ end
|
|
382
376
|
# returns currency amount formatted like "$4,5123.00". 0.00 is formatted as "$0"
|
383
377
|
# this is not ideal
|
384
378
|
def format_money(amount, currency='usd', opts={})
|
385
|
-
|
379
|
+
amount = amount.to_f
|
380
|
+
if amount == 0
|
386
381
|
return currency_sym(currency).to_s + "0"
|
387
382
|
# elsif amount.to_f < 0.01
|
388
383
|
# # return exponent notation like 3.4e-09
|
389
384
|
# return currency_sym(currency).to_s + "#{amount}"
|
390
385
|
else
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
elsif rtn.split('.')[1].length < 2
|
395
|
-
rtn = rtn + (['0'] * (2 - rtn.split('.')[1].length) * '')
|
396
|
-
end
|
397
|
-
dollars,cents = rtn.split(".")
|
398
|
-
rtn = currency_sym(currency).to_s + format_number(dollars.to_i.abs) + "." + cents
|
399
|
-
|
400
|
-
if dollars.to_i < 0
|
386
|
+
sigdig = opts[:sigdig] ? opts[:sigdig].to_i : 2
|
387
|
+
rtn = currency_sym(currency).to_s + format_number(sprintf("%.#{sigdig}f", amount))
|
388
|
+
if amount.to_i < 0
|
401
389
|
rtn = "(#{rtn})"
|
402
390
|
if opts[:minus_color]
|
403
391
|
rtn = "#{opts[:minus_color]}#{rtn}#{opts[:return_color] || cyan}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morpheus-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Estes
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|