Class: Source2Pdf::CLI

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

Instance Method Summary collapse

Instance Method Details

#exportObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/source2pdf/cli.rb', line 35

def export
  #opts = options.symbolize_keys(options)
  opts = options
  exporter = Source2Pdf::Exporter.new opts[:url],
                                      exts:        opts[:exts],
                                      non_exts:    opts[:non_exts],
                                      theme:       opts[:theme],
                                      output_name: opts[:output_name]

  exporter.export
end

#usageObject



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
# File 'lib/source2pdf/cli.rb', line 48

def usage
  puts "Usage:\n\n  $source2pdf -u, --url=URL -e, --exts=EXT1 EXT2 EXT3 -t, --theme=theme_name -o, --output-name=output_file.pdf\n\nExample:\n\n  # Export the *.rb from the given repository\n\n  $source2pdf -u https://github.com/agilecreativity/source2pdf.git -e rb\n\n  # Export the *.rb and also 'Gemfile' from a 'source2pdf' directory\n  # Note: this directory must be directly below the current directory\n\n  $source2pdf -u source2pdf -e rb -f Gemfile\n\n  # Same as previous command with the 'solarized' instead of 'default' colorscheme\n  $source2pdf -u source2pdf -e rb -f Gemfile -t solarized\n\nOptions:\n\n  -u, --url=URL                   # The full url of the git repository to be cloned OR local directory name\n\n  -e, --exts=EXT1 EXT2 EXT3 ..    # The list of extension names to be exported\n                              # e.g. -e md rb java\n\n  -f, [--non-exts=one two three]  # The list of file without extension to be exported\n                              # e.g. -f Gemfile LICENSE\n\n  -t, [--theme=theme_name]        # The theme/colorscheme to be used with vim_printer see :help :colorscheme from inside Vim\n                              # default: 'default'\n                              # e.g. -t solarized\n\n  -o, [--output-name=output.pdf]  # The output pdf filename (will default to 'repository_name'.pdf)\n                              # e.g. -o repository_name.pdf\n\nExport a given Git's repository or a local project directory to a single pdf file\n\n  EOS\nend\n"