Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
require 'slideshow' | ||
|
||
Slideshow.main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,120 +1,121 @@ | ||
# encoding: utf-8 | ||
|
||
|
||
LogUtils::Logger.root.level = :info # set logging level to info | ||
|
||
|
||
require 'gli' | ||
|
||
include GLI::App | ||
|
||
program_desc 'Slide Show (S9) - a free web alternative to PowerPoint and Keynote' | ||
|
||
## | ||
## -t/--template ?? | ||
## -c/--config-dir ?? | ||
version Slideshow::VERSION | ||
|
||
|
||
## some setup code | ||
|
||
LogUtils::Logger.root.level = :info # set logging level to info | ||
|
||
opts = Slideshow::Opts.new | ||
|
||
|
||
|
||
## "global" options (switches/flags) | ||
|
||
desc "(Debug) Show debug messages" # add --debug as alias? - add -w why? why not? | ||
switch [:verbose] # NB: using -w as switch not -v (-v is used for version) - why w? who else is using it? ruby interpreter? check | ||
|
||
desc "Only show warnings, errors and fatal messages" | ||
switch [:q, :quiet] | ||
|
||
|
||
global_option '-i', '--include PATH', String, "Data path (default is #{myopts.data_path})" | ||
global_option '-d', '--dbpath PATH', String, "Database path (default is #{myopts.db_path})" | ||
global_option '-n', '--dbname NAME', String, "Database name (datault is #{myopts.db_name})" | ||
desc "Configuration Path (default is #{opts.config_path})" | ||
arg_name 'PATH' | ||
flag [:c, :config] | ||
|
||
global_option '-q', '--quiet', "Only show warnings, errors and fatal messages" | ||
### todo/fix: just want --debug/--verbose flag (no single letter option wanted) - fix | ||
global_option '-w', '--verbose', "Show debug messages" | ||
desc "Template Manifest (default is #{opts.manifest})" | ||
arg_name 'MANIFEST' | ||
flag [:t, :template] | ||
|
||
|
||
|
||
desc 'Build slideshow' | ||
command [:b,:build] do |c| | ||
|
||
c.desc 'Verbose/Debug' | ||
c.switch :verbose | ||
c.desc 'Set Header Level to 1 (default)' | ||
c.switch [:h1] # todo: add :1 if it works e.g. -1 why? why not?? | ||
|
||
c.desc 'Set Header Level to 2' | ||
c.switch [:h2] | ||
|
||
c.desc 'Use only !SLIDE for slide breaks (Showoff Compatible)' | ||
c.switch [:slide] | ||
|
||
# cmd.on( '--h1', 'Set Header Level to 1 (default)' ) { opts.header_level = 1 } | ||
# cmd.on( '--h2', 'Set Header Level to 2' ) { opts.header_level = 2 } | ||
# | ||
# cmd.on( '--slide', 'Use only !SLIDE for slide breaks (Showoff Compatible)' ) do | ||
# opts.slide = true | ||
# end | ||
# | ||
# cmd.on( '--takahashi', 'Allow // for slide breaks' ) do | ||
# opts.takahashi = true | ||
# end | ||
c.desc 'Allow // for slide breaks' | ||
c.switch [:takahashi] | ||
|
||
|
||
c.desc 'Config Folder' | ||
c.default_value "tbd" # use opts.template ?? | ||
c.flag [:c,:config] | ||
|
||
c.desc 'Output Folder' | ||
c.default_value "tbd" # use opts.template ?? | ||
c.desc "Output Path (default is #{opts.output_path})" | ||
c.arg_name 'PATH' | ||
c.flag [:o,:output] | ||
|
||
c.desc 'Template' | ||
c.default_value "tbd" # use opts.template ?? | ||
c.flag [:t,:template] | ||
|
||
c.action do |global_options,options,args| | ||
|
||
load_plugins # check for optional plugins/extension in ./lib folder | ||
|
||
args.each do |arg| | ||
files = find_files( arg ) | ||
files.each do |file| | ||
### fix/todo: reset/clean headers | ||
Gen.new( opts, config, headers ).create_slideshow( file ) | ||
end | ||
end | ||
puts "hello from build command" | ||
|
||
end | ||
end | ||
|
||
|
||
desc 'List all installed template packs' | ||
command [:l,:ls,:list] do |c| | ||
c.desc 'List all installed template packs' | ||
|
||
c.action do |global_options,options,args| | ||
List.new( opts, config ).run ### todo: remove opts (merge access into config) | ||
|
||
puts "hello from list command" | ||
|
||
end | ||
end | ||
|
||
|
||
desc 'Install (fetch) template pack' | ||
command [:f,:fetch,:i,:install] do |c| | ||
c.desc 'Install/fetch template pack' | ||
|
||
c.action do |global_options,options,args| | ||
|
||
Fetch.new( opts, config ).run ### todo: remove opts | ||
puts "hello from install/fetch command" | ||
|
||
end | ||
end | ||
|
||
|
||
command [:q,:quick,:n,:new] do |c| # quick - use g,gen,generate? too for templates? | ||
c.action do |global_options,options,args| | ||
|
||
## if opts.quick? | ||
Quick.new( opts, config ).run ### todo: remove opts | ||
c.action do |global_options,options,args| | ||
|
||
## if opts.generate? | ||
GenTemplates.new( opts, config ).run ### todo: remove opts | ||
puts "hello from quick/new command" | ||
|
||
end | ||
end | ||
|
||
|
||
command [:a,:about,:info] do |c| | ||
c.action do | ||
# do something here | ||
puts "hello from about command" | ||
end | ||
end | ||
|
||
|
||
command [:p,:plugin,:plugins] do |c| | ||
c.action do | ||
# if opts.plugins? | ||
Plugins.new( opts, config ).run ### todo: remove opts (merge access into config) | ||
puts "hello from plugin command" | ||
end | ||
end | ||
|
||
command :test do |c| | ||
c.action do | ||
puts "hello from test command" | ||
end | ||
end | ||
|
||
|
||
exit run(ARGV) |