Sha256: 0a0796598f58f93bee7dc186aff81348e09ead7ce8459718f9cdfdc65bfe8c71

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 KB

Contents

#!/usr/bin/env ruby

# require "bundler/setup" # for development
require "golink"

# Instance class
golink = Jekyll::Golink::Theme::Main.new

# Definition of outgoing messages on the console.
HEADER = <<ENDHEADER
#{Jekyll::Golink::Theme::NAME} v#{Jekyll::Golink::Theme::VERSION} -- A minimalist theme for Jekyll, to redirect links.

ENDHEADER

USAGE = <<ENDUSAGE
Usage:
   #{Jekyll::Golink::Theme::NAME_EXE} [-h --help ] [-v --version] [-i init]

ENDUSAGE

HELP = <<ENDHELP
   -h, --help       Show this help.
   -v, --version    Show the version number.
   -i, init         Create the theme structure in the current directory.

ENDHELP

# Variable to capture whether or not subcommand exists.
ARGS = {}

# Block responsible for starting to do the subcommand search.
ARGV.each do |arg|
  case arg
    when '-h','--help'
      ARGS[:correct] = true
      puts HEADER; puts USAGE; puts HELP;
    when '-i','init'
      ARGS[:correct] = true
      golink.init
    when '-v','--version'
      ARGS[:correct] = true
      puts "#{Jekyll::Golink::Theme::NAME} v#{Jekyll::Golink::Theme::VERSION}"
    else
      ARGS[:invalid] = true
      puts "Invalid subcommand.".red
      puts HEADER; puts USAGE; puts HELP;
  end
end

# If no subcommand is mentioned, it displays the warning and help message.
if !ARGS[:invalid] and !ARGS[:correct]
   puts "A subcommand is required.".red
   puts HEADER; puts USAGE; puts HELP;
  exit
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
golink-1.0.9 exe/golink
golink-1.0.8 exe/golink
golink-1.0.7 exe/golink
golink-1.0.6 exe/golink
golink-1.0.4 exe/golink
golink-1.0.3 exe/golink
golink-1.0.2 exe/golink
golink-1.0.1 exe/golink