Sha256: 8f4237de5b3bcd9f471650beeccdddeea2a909d3e92b9cfa72e2e00fa4f8d9ce

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

#!/usr/bin/env ruby
#> Usage: vimdeck [<command>] [<file>]
#>
#> Commands:
#>
#>   slideshow          generate and show slides (default)
#>   generate           generate slides only
#>   open               open slides in presentation folder (no file needed)
#>
#> Options:
#>
#    --no-indent, -I    skip indentation
#>   --no-ascii, -A     skip ascii headers

require "optparse"
require "vimdeck"
# require_relative File.dirname(__FILE__)+"/../../lib/vimdeck.rb"

def usage
  File.read(__FILE__).split("\n").grep(/^#>/).each do |line|
    puts line[3..-1]
  end
end

def check_file(file, opt_parser)
  if !file || !File.exists?(file)
    usage
    puts "\nFile does not exist! #{file}"
    exit 0
  end
end

options = {}

opt_parser = OptionParser.new do |opt|
  opt.on("-A", "--no-ascii") do
    options[:no_ascii] = true
  end

  opt.on("-I", "--no-indent") do
    options[:no_indent] = true
  end
end

opt_parser.parse!

file = ARGV.length > 1 ? ARGV[1] : ARGV[0]

if !ARGV[0] || ( ARGV[0] && ARGV[0] != "open" )
  check_file(file, opt_parser)
end

case ARGV[0]
when "slideshow"
  Vimdeck::Slideshow.start(file, options)
when "generate"
  Vimdeck::Slideshow.generate(file, options)
when "open"
  if ARGV.length == 2
    puts "Vimdeck will open already existing slides"
    puts "File name will be ignored"
    sleep 3
  end

  Vimdeck::Slideshow.open
else
  Vimdeck::Slideshow.start(file, options)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vimdeck-0.1.12 bin/vimdeck
vimdeck-0.1.11 bin/vimdeck
vimdeck-0.1.10 bin/vimdeck
vimdeck-0.1.9 bin/vimdeck