(declare (unit tick-get)) (module tick-get () (import scheme) (import (chicken base) (chicken format) (chicken string)) (import commands optimism) (import tick) (define-command 'get #<#EOF get [--bare|-b] [] Get properties of tickets. --bare|-b Only show value, not property name. : --summary|-S Ticket summary. --type|-t Valid types: #{(string-intersperse (valid-types) ", ")} --component|-c Valid components: #{(string-intersperse (valid-components) ", ")} --difficulty|-d Valid difficulties: #{(string-intersperse (valid-difficulties) ", ")} --priority|-p Valid priorities: #{(string-intersperse (valid-priorities) ", ")} --owner|-o Check the output of "tick list users" for the list of owners. --version|-v Check the output of "tick list versions" for the list of versions. --milestone|-m Check the output of "tick list milestones" for the list of versions. --status|-s Valid statuses: #{(string-intersperse (valid-statuses) ", ")} --reporter|-R Check the output of "tick list users" for the list of reporters. --resolution|-r Valid resolutions: #{(string-intersperse (valid-resolutions) ", ")} --cc|-C Users/emails to add as Cc for the ticket. --keywords|-k Arbitrary keywords for the ticket. --changetime|-T Changetime (last modification time) in microseconds. EOF ;; --this-is-here-just-to-fool-emacs-syntax-highlight| (lambda (args*) (let* ((args (parse-command-line args* `(((--summary -S)) ((--type -t)) ((--component -c)) ((--difficulty -d)) ((--priority -p)) ((--owner -o)) ((--version -v)) ((--milestone -m)) ((--status -s)) ((--resolution -r)) ((--reporter -R)) ((--cc -C)) ((--keywords -k)) ((--bare -b)) ((--changetime -T)) ((--) . tid)))) (summary (get-opt '(--summary -S) args)) (type (get-opt '(--type -t) args)) (component (get-opt '(--component -c) args)) (difficulty (get-opt '(--difficulty -d) args)) (priority (get-opt '(--priority -p) args)) (owner (get-opt '(--owner -o) args)) (version (get-opt '(--version -v) args)) (milestone (get-opt '(--milestone -m) args)) (status (get-opt '(--status -s) args)) (cc (get-opt '(--cc -C) args)) (keywords (get-opt '(--keywords -k) args)) (resolution (get-opt '(--resolution -r) args)) (reporter (get-opt '(--reporter -R) args)) (thash (let ((rest (get-opt '(--) args))) (if (or (null? rest) (not (null? (cdr rest)))) (show-command-help 'get 1) (ensure-ticket (car rest))))) (bare (get-opt '(--bare -b) args)) (changetime (get-opt '(--changetime -T) args)) (ticket (read-ticket thash))) (set-last-used-ticket-hash! thash) (define (retrieve property) (print (if bare "" (string-append (symbol->string property) ": ")) (or (ticket-ref ticket property) ""))) (when summary (retrieve 'summary)) (when type (retrieve 'type)) (when component (retrieve 'component)) (when difficulty (retrieve 'difficulty)) (when priority (retrieve 'priority)) (when owner (retrieve 'owner)) (when version (retrieve 'version)) (when milestone (retrieve 'milestone)) (when status (retrieve 'status)) (when cc (retrieve 'cc)) (when keywords (retrieve 'keywords)) (when resolution (retrieve 'resolution)) (when reporter (retrieve 'reporter)) (when changetime (retrieve 'changetime))))) ) ;; end module