Skip to content
This repository

Added few yaml output formats for show command, to help developing #55 #56

Merged
merged 1 commit into from about 1 year ago

2 participants

Taras Kalapun Fabio Pelosin
Taras Kalapun
Collaborator

No description provided.

Fabio Pelosin
Owner

Any update on this?

Taras Kalapun
Collaborator
xslim commented April 03, 2013

Oh, didn't noticed that Travis failed the build for 1.8. I donna how to fix that, some permission problems...

Fabio Pelosin irrationalfab merged commit 83d16a1 into from April 03, 2013
Fabio Pelosin irrationalfab closed this April 03, 2013
Fabio Pelosin
Owner

The failure appears to have been momentary, I've restarted the build however it failed again :-)

As I've seen that you are interested in the dev of CP and Xcodeproj let me know if you would like to join our campfire room.

Taras Kalapun
Collaborator
xslim commented April 03, 2013

Sure, let me in!
Can't promise full-time development, but will help as best as I can

Fabio Pelosin
Owner

Sent! Is not about dev… it is about enlightened discussion :wink:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 26, 2013
Taras Kalapun Added few yaml output formats for show command, to help developing #55 83d16a1
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 26 additions and 0 deletions. Show diff stats Hide diff stats

  1. 26  lib/xcodeproj/command/show.rb
26  lib/xcodeproj/command/show.rb
@@ -10,14 +10,40 @@ def self.banner
10 10
       for one.}
11 11
       end
12 12
 
  13
+      def self.options
  14
+        [
  15
+          ["--format [hash|tree_hash|raw]", "YAML output format, optional"],
  16
+        ].concat(super)
  17
+      end
  18
+
13 19
       def initialize(argv)
14 20
         xcodeproj_path = argv.shift_argument
15 21
         @xcodeproj_path = File.expand_path(xcodeproj_path) if xcodeproj_path
  22
+        
  23
+        if argv.option('--format')
  24
+          @output_format = argv.shift_argument
  25
+        end
  26
+
16 27
         super unless argv.empty?
17 28
       end
18 29
 
19 30
       def run
20 31
         require 'yaml'
  32
+
  33
+        if @output_format
  34
+          case @output_format.to_sym
  35
+          when :hash
  36
+            puts xcodeproj.to_hash.to_yaml
  37
+          when :tree_hash
  38
+            puts xcodeproj.to_tree_hash.to_yaml
  39
+          when :raw
  40
+            puts xcodeproj.to_yaml
  41
+          else
  42
+            raise Informative, "Unknowh format #{@output_format}!"
  43
+          end
  44
+          return
  45
+        end
  46
+
21 47
         pretty_print = xcodeproj.pretty_print
22 48
         sections = []
23 49
         pretty_print.each do |key, value|
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.