Class: Lutaml::Cli::InteractiveShell
- Inherits:
-
Object
- Object
- Lutaml::Cli::InteractiveShell
- Defined in:
- lib/lutaml/cli/interactive_shell.rb,
lib/lutaml/cli/interactive_shell/command_base.rb,
lib/lutaml/cli/interactive_shell/help_display.rb,
lib/lutaml/cli/interactive_shell/export_handler.rb,
lib/lutaml/cli/interactive_shell/query_commands.rb,
lib/lutaml/cli/interactive_shell/bookmark_commands.rb,
lib/lutaml/cli/interactive_shell/navigation_commands.rb
Defined Under Namespace
Classes: BookmarkCommands, CommandBase, ExportHandler, HelpDisplay, NavigationCommands, QueryCommands
Constant Summary collapse
- HISTORY_FILE =
File.("~/.lutaml-xmi-history")
- MAX_HISTORY =
1000
Instance Attribute Summary collapse
-
#bookmarks ⇒ Object
readonly
Returns the value of attribute bookmarks.
-
#bookmarks_cmd ⇒ Object
readonly
Returns the value of attribute bookmarks_cmd.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#current_path ⇒ Object
Returns the value of attribute current_path.
-
#export ⇒ Object
readonly
Returns the value of attribute export.
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#last_results ⇒ Object
Returns the value of attribute last_results.
-
#navigation ⇒ Object
readonly
Returns the value of attribute navigation.
-
#path_history ⇒ Object
readonly
Returns the value of attribute path_history.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#initialize(lur_path_or_repo, config: nil) ⇒ InteractiveShell
constructor
A new instance of InteractiveShell.
- #start ⇒ Object
Constructor Details
#initialize(lur_path_or_repo, config: nil) ⇒ InteractiveShell
Returns a new instance of InteractiveShell.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 26 def initialize(lur_path_or_repo, config: nil) @config = default_config.merge(config || {}) @repository = load_repository(lur_path_or_repo) @current_path = "ModelRoot" @bookmarks = {} @last_results = nil @path_history = ["ModelRoot"] @running = false init_commands setup_readline load_history end |
Instance Attribute Details
#bookmarks ⇒ Object (readonly)
Returns the value of attribute bookmarks.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def bookmarks @bookmarks end |
#bookmarks_cmd ⇒ Object (readonly)
Returns the value of attribute bookmarks_cmd.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def bookmarks_cmd @bookmarks_cmd end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def config @config end |
#current_path ⇒ Object
Returns the value of attribute current_path.
24 25 26 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 24 def current_path @current_path end |
#export ⇒ Object (readonly)
Returns the value of attribute export.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def export @export end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def help @help end |
#last_results ⇒ Object
Returns the value of attribute last_results.
24 25 26 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 24 def last_results @last_results end |
#navigation ⇒ Object (readonly)
Returns the value of attribute navigation.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def @navigation end |
#path_history ⇒ Object (readonly)
Returns the value of attribute path_history.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def path_history @path_history end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def query @query end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
20 21 22 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 20 def repository @repository end |
Instance Method Details
#start ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/lutaml/cli/interactive_shell.rb', line 41 def start @running = true @help.display_welcome run_repl_loop save_history puts "\nGoodbye!" end |