Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated existing code to take advantage of the new option destructuri…

…ng stuff in cake.
  • Loading branch information...
commit 8c28946506e9b4524334e6121e2e2c8c2742dd62 1 parent 94e8504
Anthony Grimes authored

Showing 2 changed files with 33 additions and 52 deletions. Show diff stats Hide diff stats

  1. +2 2 src/cake_github/gists.clj
  2. +31 50 src/cake_github/repos.clj
4 src/cake_github/gists.clj
@@ -16,8 +16,8 @@
16 16
17 17 (deftask github.gists.contents
18 18 "Show the contents of a gist. Pass in the id of the gist and the file name."
19   - (format-result
20   - (show-gist auth ((:github.gists.contents *opts*) 0) ((:github.gists.contents *opts*) 1))))
  19 + [{[one two] :github.gists.contents}]
  20 + (format-result (show-gist auth one two)))
21 21
22 22 (deftask github.gists.show
23 23 "Show metadata for another user's gists. Pass in the name of the user. Pass in --results
81 src/cake_github/repos.clj
@@ -33,38 +33,36 @@
33 33
34 34 (deftask github.repos.fork
35 35 "Fork a repo. Pass in the owner of the repo you want to fork and the name of the repo."
36   - (format-result
37   - (fork-repo auth ((:github.repos.fork *opts*) 0) ((:github.repos.fork *opts*) 1))
38   - :generate-clone-urls true))
  36 + [{[one two] :github.repos.fork}]
  37 + (format-result (fork-repo auth one two) :generate-clone-urls true))
39 38
40 39 (deftask github.repos.set
41 40 "Set information about a repo. Pass in the owner of the repo, the name of the repo,
42 41 the key corresponding to the information you want to change, and the value you want
43 42 to set it to. Possible keys are description, homepage, has_wiki, has_downloads,
44 43 and has_issues."
45   - (let [opts (:github.repos.set *opts*)]
46   - (format-result (set-repo-info auth (opts 0) (opts 1) (opts 2) (opts 3)))))
  44 + [{[one two three four] :github.repos.set}]
  45 + (format-result (set-repo-info auth one two three four)))
47 46
48 47 (deftask github.repos.info
49 48 "Get infomation about a repository. Pass in the owner of the repo and the name of the repo."
50   - (format-result
51   - (show-repo-info auth ((:github.repos.info *opts*) 0) ((:github.repos.info *opts*) 1))))
  49 + [{[one two] :github.repos.info}]
  50 + (format-result (show-repo-info auth one two)))
52 51
53 52 (deftask github.repos.watch
54 53 "Watch a repo. Pass in the owner of the repo and the name of the repo."
55   - (format-result
56   - (watch-repo auth ((:github.repos.watch *opts*) 0) ((:github.repos.watch *opts*) 1))))
  54 + [{[one two] :github.repos.watch}]
  55 + (format-result (watch-repo auth one two)))
57 56
58 57 (deftask github.repos.unwatch
59 58 "Unwatch a repo. Pass in the owner of the repo and the name of the repo."
60   - (format-result
61   - (unwatch-repo auth ((:github.repos.unwatch *opts*) 0) ((:github.repos.unwatch *opts*) 1))))
  59 + [{[one two] :github.repos.unwatch}]
  60 + (format-result (unwatch-repo auth one two)))
62 61
63 62 (deftask github.repos.tags
64 63 "List the tags on a repo. Pass in the owner of the repo and it's name."
65   - (format-result
66   - (show-tags auth ((:github.repos.tags *opts*) 0) ((:github.repos.tags *opts*) 1))
67   - :map-type :generic))
  64 + [{[one two] :github.repos.tag}]
  65 + (format-result (show-tags auth one two) :map-type :generic))
68 66
69 67 (deftask github.repos.pushable
70 68 "List all the repos that you don't own that you can push to. Limit results with --results.
@@ -74,71 +72,54 @@
74 72 (deftask github.repos.network
75 73 "Show a repository's full network. Pass in the owner and name of the repository.
76 74 Limit results with --results. The default limit is three."
77   - (format-result
78   - (show-network auth ((:github.repos.network *opts*) 0) ((:github.repos.network *opts*) 1))
79   - :max (:results *opts*)))
  75 + [{[one two] :github.repos.network results :results}]
  76 + (format-result (show-network auth one two) :max results))
80 77
81 78 (deftask github.repos.languages
82 79 "List the languages used in a project. Values are in bytes. Limit results with --results.
83 80 The default limit is three."
84   - (format-result
85   - (show-languages auth ((:github.repos.languages *opts*) 0) ((:github.repos.languages *opts*) 1))
86   - :max (:results *opts*) :map-type :generic))
  81 + [{[one two] :github.repos.languages results :results}]
  82 + (format-result (show-languages auth one two) :max results :map-type :generic))
87 83
88 84 (deftask github.repos.contributors
89 85 "List everybody who has contributed to a repo, including non-github-users.
90 86 Pass the owner and name of the repository. Limit results with --results. Default limit is three."
91   - (format-result
92   - (show-contributors auth
93   - ((:github.repos.contributors *opts*) 0)
94   - ((:github.repos.contributors *opts*) 1))
95   - :map-type :user :max (:results *opts*)))
  87 + [{[one two] :github.repos.contributors results :results}]
  88 + (format-result (show-contributors auth one two) :map-type :user :max results))
96 89
97 90 (deftask github.repos.collaborators
98 91 "List collaborators on a repo. Pass the owner and name of the repo."
99   - (format-result
100   - (show-collaborators auth
101   - ((:github.repos.collaborators *opts*) 0)
102   - ((:github.repos.collaborators *opts*) 1))))
  92 + [{[one two] :github.repos.collaborators}]
  93 + (format-result (show-collaborators auth one two)))
103 94
104 95 (deftask github.repos.add-collaborator
105 96 "Add a collaborator to your Github repository. Pass in the username you want to add and the
106 97 name of the repo."
107   - (format-result
108   - (add-collaborator auth
109   - ((:github.repos.add-collaborator *opts*) 0)
110   - ((:github.repos.add-collaborator *opts*) 1))))
  98 + [{[one two] :github.repos.add-collaborator}]
  99 + (format-result (add-collaborator auth one two)))
111 100
112 101 (deftask github.repos.rm-collaborator
113 102 "Remove a collaborator from your Github repository. Pass in the username you want to remove
114 103 and the name of the repo."
115   - (format-result
116   - (remove-collaborator auth
117   - ((:github.repos.rm-collaborator *opts*) 0)
118   - ((:github.repos.rm-collaborator *opts*) 1))))
  104 + [{[one two] :github.repos.rm-collaborator}]
  105 + (format-result (remove-collaborator auth one two)))
119 106
120 107 (deftask github.repos.deploy
121 108 "List the deploy keys for a repository. Pass in the name of the repo."
122   - (format-result
123   - (show-deploy-keys auth ((:github.repos.deploy *opts*) 0))))
  109 + (format-result (show-deploy-keys auth ((:github.repos.deploy *opts*) 0))))
124 110
125 111 (deftask github.repos.add-deploy
126 112 "Add a deploy key to a repository. Pass in the name of the repository, title of the key
127 113 and the key itself."
128   - (format-result
129   - (add-deploy-key auth
130   - ((:github.repos.add-deploy *opts*) 0)
131   - ((:github.repos.add-deploy *opts*) 1)
132   - ((:github.repos.add-deploy *opts*) 2))))
  114 + [{[one two three] :github.repos.add-deploy}]
  115 + (format-result (add-deploy-key auth one two three)))
133 116
134 117 (deftask github.repos.rm-deploy
135 118 "Remove a deploy key from a repository. Pass in the name of the repo and the title of the key."
136   - (format-result
137   - (remove-deploy-key auth
138   - ((:github.repos.rm-deploy *opts*) 0)
139   - ((:github.repos.rm-deploy *opts*) 1))))
  119 + [{[one two] :github.repos.rm-deploy}]
  120 + (format-result (remove-deploy-key auth one two)))
140 121
141 122 (deftask github.repos.visibility
142 123 "Set a repository's visibility. Pass in the name of the repo and either 'public' or 'private'."
143   - (format-result
144   - (set-repo-visibility ((:github.repos.visibility *opts*) 0) ((:github.repos.visibility *opts*) 1))))
  124 + [{[one two] :github.repos.visibility}]
  125 + (format-result (set-repo-visibility one two)))

0 comments on commit 8c28946

Please sign in to comment.
Something went wrong with that request. Please try again.