-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
36 lines (26 loc) · 1.12 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env ruby
require 'gli'
require_relative 'lib/bootstrap'
module AnyStyleWorkflowCLI
extend GLI::App
program_desc 'AnyStyle reference extraction workflow'
# Global option for verbose output
switch [:verbose], desc: 'Output additional information', negatable: false
# Global option for debug output
switch [:debug], desc: 'Output debug information', negatable: false
# Global option to clean output directories before running a command
switch [:clean], desc: 'Clean output directories before running command', negatable: false
# You can also use the `pre` block to perform actions based on global options before any command executes
pre do |global, command, options, args|
# Example: Output a message if verbose mode is enabled
if global[:verbose]
puts "Running in verbose mode..."
end
# Return true to continue executing the command, false to stop
true
end
# Similarly, a `post` block could be used to perform actions after command execution
# auto-register commands
Dir[File.join(__dir__, 'commands', '*.rb')].each { |file| require file }
end
AnyStyleWorkflowCLI.run(ARGV)