-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the top-level command structure.
- Loading branch information
Showing
12 changed files
with
191 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.buildpath | ||
.project | ||
.README.md.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class CmdCapture | ||
def initialize(args) | ||
bogus "CmdCapture.initialize NOT IMPLEMENTED" | ||
end | ||
|
||
def run() | ||
bogus "CmdCapture.run NOT IMPLEMENTED" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class CmdCompare | ||
def initialize(args) | ||
bogus "CmdCompare.initialize NOT IMPLEMENTED" | ||
end | ||
|
||
def run() | ||
bogus "CmdCompare.run NOT IMPLEMENTED" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CmdCompareAgain | ||
def initialize(args) | ||
bogus "CmdCompareAgain.initialize NOT IMPLEMENTED" | ||
end | ||
|
||
def run() | ||
bogus "CmdCompareAgain.run NOT IMPLEMENTED" | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CmdDisplay | ||
def initialize(args) | ||
bogus "CmdDisplay.initialize NOT IMPLEMENTED" | ||
end | ||
|
||
def run() | ||
bogus "CmdDisplay.run NOT IMPLEMENTED" | ||
end | ||
end | ||
|
10 changes: 10 additions & 0 deletions
10
cmd_prepare_self_editor_account/cmd_prepare_self_editor_account.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CmdPrepareSelfEditorAccount | ||
def initialize(args) | ||
bogus "CmdPrepareSelfEditorAccount.initialize NOT IMPLEMENTED" | ||
end | ||
|
||
def run() | ||
bogus "CmdPrepareSelfEditorAccount.run NOT IMPLEMENTED" | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CmdPrepareSessionList | ||
def initialize(args) | ||
bogus "CmdPrepareSessionList.initialize NOT IMPLEMENTED" | ||
end | ||
|
||
def run() | ||
bogus "CmdPrepareSessionList.run NOT IMPLEMENTED" | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CmdPrepareSubList | ||
def initialize(args) | ||
bogus "CmdPrepareSubList.initialize NOT IMPLEMENTED" | ||
end | ||
|
||
def run() | ||
bogus "CmdPrepareSubList.run NOT IMPLEMENTED" | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class CmdPrepareUriList | ||
def initialize(args) | ||
bogus "CmdPrepareUriList.initialize NOT IMPLEMENTED" | ||
end | ||
|
||
def run() | ||
bogus "CmdPrepareUriList.run NOT IMPLEMENTED" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Helpful classes and utility methods. | ||
# | ||
class UserInputError < StandardError | ||
end | ||
|
||
class SettingsError < StandardError | ||
end | ||
|
||
def warning(message) | ||
puts("WARNING: #{message}") | ||
end | ||
|
||
module Kernel | ||
def bogus(message) | ||
puts(">>>>>>>>>>>>>BOGUS #{message}") | ||
end | ||
end | ||
|
||
require_relative 'cmd_prepare_uri_list/cmd_prepare_uri_list' | ||
require_relative 'cmd_prepare_session_list/cmd_prepare_session_list' | ||
require_relative 'cmd_prepare_self_editor_account/cmd_prepare_self_editor_account' | ||
require_relative 'cmd_prepare_sub_list/cmd_prepare_sub_list' | ||
require_relative 'cmd_capture/cmd_capture' | ||
require_relative 'cmd_compare/cmd_compare' | ||
require_relative 'cmd_compare_again/cmd_compare_again' | ||
require_relative 'cmd_display/cmd_display' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#! /usr/bin/env ruby | ||
|
||
require_relative 'common' | ||
|
||
class Vivosnap | ||
COMMANDS = [ | ||
[:CmdPrepareUriList, ['prepare', 'uri-list']], | ||
[:CmdPrepareSessionList, ['prepare', 'session-list']], | ||
[:CmdPrepareSelfEditorAccount, ['prepare', 'self-editor-account']], | ||
[:CmdPrepareSubList, ['prepare', 'sub-list']], | ||
[:CmdCapture, ['capture']], | ||
[:CmdCompareAgain, ['compare', 'again']], | ||
[:CmdCompare, ['compare']], | ||
[:CmdDisplay, ['display']] | ||
] | ||
|
||
def initialize(args) | ||
COMMANDS.each do |cmd| | ||
cmd_args = cmd[1] | ||
matching_args = args.take(cmd_args.size) | ||
remaining_args = args.drop(cmd_args.size) | ||
if cmd_args == matching_args | ||
@cmd_instance = Object.const_get(cmd[0]).new(remaining_args) | ||
return | ||
end | ||
end | ||
raise UserInputError.new("Arguments not valid: #{args.join(' ')}\nValid choices are #{format_cmds}") | ||
end | ||
|
||
def format_cmds() | ||
"\n #{COMMANDS.map {|c| c[1].join(' ') }.join("\n ")}" | ||
end | ||
|
||
def run() | ||
@cmd_instance.run() | ||
end | ||
end | ||
|
||
# | ||
# --------------------------------------------------------- | ||
# MAIN ROUTINE | ||
# --------------------------------------------------------- | ||
# | ||
|
||
begin | ||
Vivosnap.new(ARGV).run | ||
rescue UserInputError | ||
puts | ||
puts $! | ||
puts | ||
end |