gloo-cli 2.0 → 2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shell.rb +26 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26757505cf53f7adb80263e1e9eb6434b4296ddcde50f431b9100ad585c140b5
4
- data.tar.gz: d8f910b22f8e47b082069d5fefedb90d16750eb507b10639ec157afc7e76a4c9
3
+ metadata.gz: 3895372f8e68e7e2a85536a4a8f6ba10706111fcac9424c502a49d47b3bd4722
4
+ data.tar.gz: 5a6435ee161245664518dc3df7c9b74ad0bd799b83108f6246dcfb899c1dc9c1
5
5
  SHA512:
6
- metadata.gz: 0123e410939777c02628748c972d912ef508986d6c4d0e7f4501d7a888e245af572806f96099635ba3702c140491773e29f26e0fdf66671563824c2d23034324
7
- data.tar.gz: 26abd327ed5bc25ecb7b608b80b315e044dbb0eb3f6e8a17b3bb28982cb93f8dfbcc183285d78496a803950748bd313d792b803031f797c6f24aa623e95438d5
6
+ metadata.gz: 35bc36bf079647ecf622973e3b8039d52c75420374ab9cfb278dd838c97057d4acc1fe518574f94603b6d64eb82ed130e677a0ad184b24466fada58ff6fb9442
7
+ data.tar.gz: fff5950b3c4d76aa72dc28630fbb26203dc19b4cb2e4f0c186ebb0a2e4a0511280134bdc486535b677a67baee4a1a77162273e3dca856ae738cd847cc1781d59
data/lib/shell.rb CHANGED
@@ -16,6 +16,8 @@ class Shell < Gloo::Core::Obj
16
16
  BEFORE_ACTION = 'before_action'.freeze
17
17
  AFTER_ACTION = 'after_action'.freeze
18
18
  WITH_COMMAND = 'with_command'.freeze
19
+ NOT_IN_SCRIPT_MODE_ERR = "Could not start the shell: an app runs in App mode. Run it with 'gloo --app %s'.".freeze
20
+ UNKNOWN_APP_FOLDER = '<folder>'.freeze
19
21
 
20
22
  #
21
23
  # The name of the object type.
@@ -122,6 +124,8 @@ class Shell < Gloo::Core::Obj
122
124
  # that one command and return. Otherwise, enter the interactive REPL.
123
125
  #
124
126
  def msg_start
127
+ return script_mode_err if @engine.mode == Gloo::App::Mode::SCRIPT
128
+
125
129
  runner = get_runner
126
130
 
127
131
  # add_test_commands
@@ -130,6 +134,25 @@ class Shell < Gloo::Core::Obj
130
134
  runner.start
131
135
  end
132
136
 
137
+ #
138
+ # A shell is an app, and an app runs in App mode. Started from a
139
+ # script run (gloo folder/start.gloo) it's a mistake: report it,
140
+ # with the command that runs the app, instead of starting.
141
+ #
142
+ def script_mode_err
143
+ @engine.err format( NOT_IN_SCRIPT_MODE_ERR, app_folder )
144
+ end
145
+
146
+ #
147
+ # The folder of the file gloo was run with (in Script mode, the
148
+ # first file loaded): the folder to give --app. A placeholder if
149
+ # nothing came from a file.
150
+ #
151
+ def app_folder
152
+ pn = @engine.persist_man.maps.first&.pn
153
+ return pn ? File.dirname( pn ) : UNKNOWN_APP_FOLDER
154
+ end
155
+
133
156
  #
134
157
  # Stop the shell.
135
158
  #
@@ -247,7 +270,9 @@ class Shell < Gloo::Core::Obj
247
270
  'one-shot run from an interactive session.'
248
271
  ],
249
272
  :messages => [
250
- 'start — Start the shell. If the app was invoked with extra command-line arguments, execute that one command and return; otherwise enter the interactive REPL.',
273
+ 'start — Start the shell. If the app was invoked with extra command-line arguments, execute that one command and return; otherwise enter the interactive REPL. ' \
274
+ 'A shell is an app and runs in App mode (gloo --app {folder}): started from a script run (gloo {folder}/start.gloo) it does not start, and reports ' \
275
+ "Could not start the shell: an app runs in App mode. Run it with 'gloo --app {folder}'.",
251
276
  'stop — Stop a running shell.'
252
277
  ],
253
278
  :notes => 'No vault documentation exists for this object type — ' \
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane