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
77
78
79
|
# File 'lib/asciidoctor/confluence/options.rb', line 31
def init_options(args)
opts_parser = ::OptionParser.new do |opts|
opts.banner = <<-EOS
Usage: asciidoctor-confluence --host HOSTNAME --spaceKey SPACEKEY --title TITLE [ASCIIDOCTOR OPTIONS]... FILE...
EOS
opts.on('--host HOST', 'the hostname of the Confluence instance ') do |host|
self[:confluence][:host] = host
end
opts.on('--spaceKey SPACEKEY', 'the Confluence space within the page will be created') do |spaceKey|
self[:confluence][:space_key] = spaceKey
end
opts.on('--title TITLE', 'the title of the Confluence page') do |title|
self[:confluence][:title] = title
end
opts.on('--pageid PAGEID', 'the id of the page to update') do |page_id|
self[:confluence][:page_id] = page_id
end
opts.on('--update', 'indicate that the page must be updated instead of created') do
self[:confluence][:update] = true
end
opts.on('--username USERNAME', 'the username used if credential are need to create the page') do |spaceKey|
self[:confluence][:auth][:username] = spaceKey
end
opts.on('--password PASSWORD', 'the password used if credential are need to create the page') do |spaceKey|
self[:confluence][:auth][:password] = spaceKey
end
opts.on_tail('-h', '--help', 'Show the full helper (including Asciidoctor helper)') do
$stdout.puts opts, "\n\n"
return Asciidoctor::Cli::Options.parse! ['-h']
end
opts.on_tail('-V', '--version', 'display the version and runtime environment (or -v if no other flags or arguments)') do
$stdout.puts "Asciidoctor-confluence v#{Asciidoctor::Confluence::VERSION}\n"
return Asciidoctor::Cli::Options.parse! ['-V']
end
end
opts_parser.parse! args
check_mandatory_options
end
|