Class: GitSu::Gitsu
- Inherits:
-
Object
- Object
- GitSu::Gitsu
- Defined in:
- lib/gitsu/gitsu.rb
Instance Method Summary collapse
- #go(args) ⇒ Object
-
#initialize(switcher, output) ⇒ Gitsu
constructor
A new instance of Gitsu.
Constructor Details
#initialize(switcher, output) ⇒ Gitsu
Returns a new instance of Gitsu.
22 23 24 |
# File 'lib/gitsu/gitsu.rb', line 22 def initialize(switcher, output) @switcher, @output = switcher, output end |
Instance Method Details
#go(args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/gitsu/gitsu.rb', line 26 def go(args) = {} optparse = OptionParser.new do |opts| opts.version = GitSu::VERSION opts. = <<-BANNER Gitsu Copyright (C) 2013 drrb This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/> for details. Usage: git-su [options] user BANNER opts.on('-t', '--list', 'List the configured users') do [:list] = true end opts.on('-c', '--clear', 'Clear the current user') do [:clear] = true end opts.on('-a', '--add USER', 'Add a user in email format (e.g. John Citizen <[email protected]>)') do |user| [:add] = user end opts.on('-e', '--edit', 'Open the Gitsu config file in an editor') do [:edit] = true end [:scope] = [] opts.on('-l', '--local', 'Change user in local scope') do [:scope] << :local end opts.on('-g', '--global', 'Change user in global scope') do [:scope] << :global end opts.on('-s', '--system', 'Change user in system scope') do [:scope] << :system end opts.on('-h', '--help', 'Show this message') do [:help] = true @output.puts opts end end optparse.parse! args run(, args) end |