From 8d2d5f973a91def7a30fc2e1b7fe73ae76757835 Mon Sep 17 00:00:00 2001 From: DavidMarchant Date: Tue, 19 Mar 2019 18:12:14 +0000 Subject: [PATCH 1/4] Remove comments --- lib/inventoryware/commands/list.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/inventoryware/commands/list.rb b/lib/inventoryware/commands/list.rb index 9ff3205..d974cd0 100644 --- a/lib/inventoryware/commands/list.rb +++ b/lib/inventoryware/commands/list.rb @@ -26,8 +26,6 @@ module Inventoryware module Commands class List < Command def run - #TODO format this to have as many results fit on one line as poss. - #puts files.join(" ") files = Dir.glob(File.join(Config.yaml_dir, '*.yaml')).map! do |file| File.basename(file, '.yaml') end From 776c0e7ee39f2ad26d6ac4e6b57f6f8701af347e Mon Sep 17 00:00:00 2001 From: DavidMarchant Date: Tue, 19 Mar 2019 18:12:41 +0000 Subject: [PATCH 2/4] Output as single column --- lib/inventoryware/commands/list.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/inventoryware/commands/list.rb b/lib/inventoryware/commands/list.rb index d974cd0..ac2a30b 100644 --- a/lib/inventoryware/commands/list.rb +++ b/lib/inventoryware/commands/list.rb @@ -29,7 +29,7 @@ def run files = Dir.glob(File.join(Config.yaml_dir, '*.yaml')).map! do |file| File.basename(file, '.yaml') end - files.each_slice(3).each { |grp| puts grp.join(" ") } + puts files end end end From 6eee57938b7d7cc2b728fcf408efffdc6bb27798 Mon Sep 17 00:00:00 2001 From: DavidMarchant Date: Tue, 19 Mar 2019 18:14:34 +0000 Subject: [PATCH 3/4] Sort the list --- lib/inventoryware/commands/list.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/inventoryware/commands/list.rb b/lib/inventoryware/commands/list.rb index ac2a30b..49be4fe 100644 --- a/lib/inventoryware/commands/list.rb +++ b/lib/inventoryware/commands/list.rb @@ -29,7 +29,7 @@ def run files = Dir.glob(File.join(Config.yaml_dir, '*.yaml')).map! do |file| File.basename(file, '.yaml') end - puts files + puts files.sort end end end From ef5c5ef4071e8ef2b7b4f00aca9cbc876c3619e9 Mon Sep 17 00:00:00 2001 From: DavidMarchant Date: Tue, 19 Mar 2019 18:17:31 +0000 Subject: [PATCH 4/4] Add clarification message if no files are found --- lib/inventoryware/commands/list.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/inventoryware/commands/list.rb b/lib/inventoryware/commands/list.rb index 49be4fe..a3f7b58 100644 --- a/lib/inventoryware/commands/list.rb +++ b/lib/inventoryware/commands/list.rb @@ -29,7 +29,11 @@ def run files = Dir.glob(File.join(Config.yaml_dir, '*.yaml')).map! do |file| File.basename(file, '.yaml') end - puts files.sort + unless files.empty? + puts files.sort + else + puts "No asset files found within #{File.expand_path(Config.yaml_dir)}" + end end end end