Sha256: cac4426c724088ba92686007ed20457878dbe3ee21e31eba86c15955de9521a8
Contents?: true
Size: 1.17 KB
Versions: 7
Compression:
Stored size: 1.17 KB
Contents
#! /usr/bin/env ruby # Demonstrate how subcommands can be declared as classes require "clamp" module GitDown class AbstractCommand < Clamp::Command option ["-v", "--verbose"], :flag, "be verbose" option "--version", :flag, "show version" do puts "GitDown-0.0.0a" exit(0) end end class CloneCommand < AbstractCommand parameter "REPOSITORY", "repository to clone" parameter "[DIR]", "working directory", :default => "." def execute raise NotImplementedError end end class PullCommand < AbstractCommand option "--[no-]commit", :flag, "Perform the merge and commit the result." def execute raise NotImplementedError end end class StatusCommand < AbstractCommand option ["-s", "--short"], :flag, "Give the output in the short-format." def execute raise NotImplementedError end end class MainCommand < AbstractCommand subcommand "clone", "Clone a remote repository.", CloneCommand subcommand "pull", "Fetch and merge updates.", PullCommand subcommand "status", "Display status of local repository.", StatusCommand end end GitDown::MainCommand.run
Version data entries
7 entries across 7 versions & 2 rubygems