Commits

seydar  committed 5e35f75 Draft

FSObjects passed as arguments are now expanded to their files

  • Participants
  • Parent commits 632b6a1

Comments (0)

Files changed (1)

File lib/chitin/commands/executable.rb

       processed = args.map do |arg|
         if arg.is_a? Hash
           arg.map do |k, v|
-            if k.is_a? Symbol
-              ["#{k.to_s.size > 1 ? '--' : '-'}#{k}", v.to_s]
-            else
-              [k.to_s, v.to_s]
-            end
+            key = if k.is_a? Symbol
+                    "#{k.to_s.size > 1 ? '--' : '-'}#{k}"
+                  else
+                    k
+                  end
+
+            val = v.is_a?(FSObject) ? v.to_a : v
+
+            [key, val]
           end
         else
-          arg.to_s
+          arg.is_a?(FSObject) ? arg.to_a : arg
         end
       end
   
-      processed.flatten
+      processed.flatten.map {|a| a.to_s }
     end
 
     def args