Class: Source2Epub::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/source2epub/cli.rb

Instance Method Summary collapse

Instance Method Details

#exportObject



32
33
34
35
36
37
38
39
40
# File 'lib/source2epub/cli.rb', line 32

def export
  exporter = Source2Epub::Exporter.new options[:url],
                                       exts:       options[:exts],
                                       non_exts:   options[:non_exts],
                                       theme:      options[:theme],
                                       command:    options[:command],
                                       epub_title: options[:epub_title]
  exporter.export
end

#usageObject



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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/source2epub/cli.rb', line 43

def usage
  puts "Usage:\n\n  $source2epub -u, --url=URL -e, --exts=EXT1 EXT2 EXT3 -t, -theme=theme_name\n\nExample:\n\n  # Export the *.rb from the given repository\n\n  $source2epub -u https://github.com/agilecreativity/source2epub.git -e rb\n\n  # Export the *.rb and also 'Gemfile' from a local directory 'source2epub'\n  # Note: must be one directory directly above the current directory\n\n  $source2epub -u source2epub -e rb -f Gemfile\n\n  # Export the *.rb and also 'Gemfile' from a given directory 'source2epub'\n  # using 'solarized' theme\n  # Note: 'source2epub' must be exactly one level above current directory\n\n  $source2epub -u source2epub -e rb -f Gemfile -t solarized\n\nOptions:\n\n  -u, --url=URL                   # The full url of the github project to be cloned or local directory name (mandatory)\n                              # e.g. -u https://github.com/agilecreativity/source2epub\n                              # Or if used with the project already exist locally\n                              #      -u source2epub\n\n  -e, --exts=EXT1 EXT2 EXT3 ..    # The list of extension names to be exported (mandatory)\n                              # e.g. -e md rb\n\n  -f, [--non-exts=one two three]  # The list of file without extension to be exported (optional)\n                              # e.g. -f Gemfile LICENSE\n\n  -t, [--theme=theme_name]        # The theme to be used with vim_printer see :help :colorscheme from inside Vim\n                              # default: 'default'\n                              # e.g. -t solarized\n\n  -p, [--epub-title=title]        # The title of the epub output, if not specified the project_name will be used\n                              # e.g. -p 'My Cool Project'\n                              #\n  -s, [--command]                 # Use the input file list from the result of the given shell command\n                              # Note: the command must return the list of file to be valid\n                              # e.g. --command 'find . -type f -iname \"*.rb\" | grep -v test | grep -v _spec'\n\nExport a given git URL or local project directory to an epub file\"\n\n  EOS\nend\n"