Skip to content

Commit

Permalink
Changed some docstrings and added a shitty help command.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynes committed Jul 10, 2010
1 parent 10016dc commit 148e41b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 34 deletions.
9 changes: 7 additions & 2 deletions src/gotmilk/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(defn get-config [parameter]
(apply str (butlast (sh "git" "config" "--global" (str "github." parameter)))))

(def commands (atom {}))
(def help-map (atom {}))

(def *auth-map* {:user (get-config "user")
:pass (get-config "password")})
Expand Down Expand Up @@ -70,9 +70,14 @@

(defmacro defcommand [trigger help args & body]
`(do
(swap! commands assoc ~trigger ~help)
(swap! help-map assoc ~trigger ~help)
(defmethod execute ~trigger [worthless# ~'options & ~args] ~@body)))

(defcommand "help"
"Get help!"
[cmd]
(if cmd (println (@help-map cmd) (println (apply str (interpose "\n" (vals @help-map)))))))

(defn take-and-format [x & [n]]
(let [n (when n (Integer/parseInt n))
x (if n (take n x) x)]
Expand Down
56 changes: 30 additions & 26 deletions src/gotmilk/repos.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,65 @@
[clojure.contrib.string :only [join]]))

(defcommand "repo"
"for creation (--create) : The first argument is required, and it should be the name of the repo.
Optional following keys are as follows, in order: description, homepage, and whether or
not the repo is public which should be true or false.
"for creation (--create) : The first argument is required, and it
should be the name of the repo. Optional following keys are as follows,
in order: description, homepage, and whether or not the repo is public which
should be true or false.
for deletion (--delete): Just supply the name of the repo.
for forking (--fork): Just supply the name of the user that owns the repo, and the name of the repo,
in that order.
for forking (--fork): Just supply the name of the user that owns the repo,
and the name of the repo, in that order.
for adding a collaborator (--add-collaborator): Supply the name of the repo and the user you want to add.
for adding a collaborator (--add-collaborator): Supply the name of the repo
and the user you want to add.
for removing a collaborator (--remove-collaborator): Same as for adding one.
for adding a deploy key (--add-deploy): Supply repo, key title, and the key contents.
for removing a deploy key (--remove-deploy): Supply repo name and title of the key.
for searching (--search): Supply a string with your search terms. Optionally, supply --language=<language>
and --start-page=<start-page> to narrow your search. Also optionally supply --results=<number> to limit the
number of results gotmilk gives you.
for searching (--search): Supply a string with your search terms. Optionally,
supply --language=<language> and --start-page=<start-page> to narrow your search.
Also optionally supply --results=<number> to limit the number of results gotmilk gives you.
for setting info about a repo (--set-info): Possible keys are description, homepage, has_wiki,
has_downloads, and has_issues. Supply the username of the owner of the repo, the repo name, a key,
and that key's values.
for setting info about a repo (--set-info): Possible keys are description, homepage,
has_wiki, has_downloads, and has_issues. Supply the username of the owner of the repo,
the repo name, a key, and that key's values.
for setting repo visibility (--set-visibility): Supply the name of the repo and either 'public' or
'private'.
for setting repo visibility (--set-visibility): Supply the name of the repo and either
'public' or 'private'.
for watching a repo (--watch): Supply the user that owns the repo, and the name of the repo.
for unwatching a repo (--unwatch): Same as for watching one.
for showing the collaborators on a project (--show-collaborators): Supply the user that owns the repo,
and the name of the repo.
for showing the collaborators on a project (--show-collaborators): Supply the user that
owns the repo, and the name of the repo.
for showing the contributors to a project (--show-contributors): Supply the name of the users that owns it,
the name of the repo, and optionally --anon if you'd like to include anonymous contributors in your results.
Also optionally supply --results=<number> to limit the number of results printed.
for showing the contributors to a project (--show-contributors): Supply the name of the users
that owns it, the name of the repo, and optionally --anon if you'd like to include anonymous
contributors in your results. Also optionally supply --results=<number> to limit the number
of results printed.
for showing the deploy keys a project uses (--show-deploy-keys): Supply the name of the repo.
for showing the languages used by a project (--show-languages): Same as for --show-collaborators.
for showing a repo's network (--show-network): Same as for --show-collaborators. Also, optionally supply
--results=<number> to limit the number of results.
for showing a repo's network (--show-network): Same as for --show-collaborators. Also,
optionally supply --results=<number> to limit the number of results.
for getting a list of repos you can push to (--show-pushable): Optionally supply --results=<number> to
limit the number of results.
for getting a list of repos you can push to (--show-pushable): Optionally supply --results=<number>
to limit the number of results.
for showing detailed information about a repo (--show-repo-info): Same as for --show-collaborators.
for showing all the repos a user has (--show-repos): Supply the username. Optionally supply --results=<number>
to limit the number of results.
for showing all the repos a user has (--show-repos): Supply the username. Optionally supply
--results=<number> to limit the number of results.
for showing a repo's tags (--show-tags): Supply the name of the user who owns the repo and the repo's name.
for showing a repo's tags (--show-tags): Supply the name of the user who owns the repo and the
repo's name.
Will default to --create"
[one two three four]
Expand Down
13 changes: 7 additions & 6 deletions src/gotmilk/users.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ to unfollow a user (--unfollow): Same as for following.
to get a list of a user's followers (--followers): Same as for following.
to get a list of repos a user is watching (--watching): Supply the name of the user. Optionally supply
--results=<number> to limit the number of results printed, and --names to only get the names of the repos.
to get a list of repos a user is watching (--watching): Supply the name of the user.
Optionally supply --results=<number> to limit the number of results printed, and --names
to only get the names of the repos.
to search for users (--search): Supply the search terms. Optionally supply --results=<number> to limit the
number of results printed, and --names to only get the names of users.
to search for users (--search): Supply the search terms. Optionally supply --results=<number>
to limit the number of results printed, and --names to only get the names of users.
to set information about yourself (--set): Supply one of name, email, blog, company, location, and the
value you want to set it to."
to set information about yourself (--set): Supply one of name, email, blog, company, location,
and the value you want to set it to."
[one two three four]
(cond-options
options
Expand Down

0 comments on commit 148e41b

Please sign in to comment.