intar 2.7 → 2.8

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/intar/version.rb +1 -1
  3. data/lib/intar.rb +27 -7
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ba7f7b2c3052c0627cd7126fedc64e45e443b2652670a6f15b3a408f729d5dd
4
- data.tar.gz: efd64593e9f9e6d4fda22a426f9b5a7c3be1860594a3d31e66d383e033b55110
3
+ metadata.gz: 353105e4252052ef911b05ead40920c09770699711c077f6a0f5ea7cb3c2347e
4
+ data.tar.gz: 3e4c7bbacccbc4fac8b3502ce32e86975cd613c7683de3e119aee3b89dcbeeb9
5
5
  SHA512:
6
- metadata.gz: 1cf5dedde06257a25c4a0080c98f11f8a1735194c32cc279ce871a4d98d56685ee240d1316494c4f825af0f8a5886cbbdaba868912c376df2cb30f604e91911c
7
- data.tar.gz: 831ce595c01ec5fe97832a2699d2a866d0af6bfec61598cf45b217652f0135cec5867fe510a15b50e506f9b475a4ad0a5ffdb8404e2f031098c377b669b9bc8d
6
+ metadata.gz: c1efee80e12e3507ac442bf34cd8ced94e55513d4ae801ed6465e5f0cf32ba4e4a46de4aa76695672da9416fe5ab1c232874582f4107a07b8c7f88f1efd0868a
7
+ data.tar.gz: be88c5df6eb80b18fbebfc0946e53eaed1f9f20172b5404d1ebc8be3fc3e59418266415b314875faddfd41f831b669044f0b223ee2e4d64953566334e6d6e4b0
data/lib/intar/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  class Intar
6
6
 
7
- VERSION = "2.7".freeze
7
+ VERSION = "2.8".freeze
8
8
 
9
9
  end
10
10
 
data/lib/intar.rb CHANGED
@@ -94,6 +94,7 @@ class Intar
94
94
  end
95
95
 
96
96
 
97
+ class Clear < Exception ; end
97
98
  class Quit < Exception ; end
98
99
  class Bye < Quit ; end
99
100
  class Break < Bye ; end
@@ -107,19 +108,21 @@ class Intar
107
108
  l = readline
108
109
  l or break
109
110
  @redir = find_redirect l
110
- r = begin
111
- if l =~ /\A\\(\w+|.)\s*(.*?)\s*\Z/ then
112
- send (get_metacommand $1).method, (eval_param $2)
111
+ begin
112
+ if l.slice! /^\\(\w+|.)\s*(.*?)\s*$\n?/ then
113
+ r = send (get_metacommand $1).method, (eval_param $2)
114
+ l.empty? or @previous = l
113
115
  else
114
- l.sub! %r/\s*&\s*\z/, SUB
115
116
  begin
116
- @redir.redirect_output do eval l, @binding, @file end
117
+ r = eval_line l
117
118
  rescue SyntaxError
118
119
  raise if l.end_with? $/
119
120
  @previous = l
120
- next
121
121
  end
122
122
  end
123
+ next if @previous
124
+ rescue Clear
125
+ @previous = nil
123
126
  rescue Bye
124
127
  raise if @depth.nonzero?
125
128
  break
@@ -145,6 +148,11 @@ class Intar
145
148
 
146
149
  private
147
150
 
151
+ def eval_line l
152
+ ls = l.sub %r/\s*&\s*\z/, SUB
153
+ @redir.redirect_output do eval ls, @binding, @file end
154
+ end
155
+
148
156
  def handle_history
149
157
  unless @depth.nonzero? then
150
158
  begin
@@ -370,7 +378,7 @@ class Intar
370
378
  puts "Metacommand: #{names.join ' '}"
371
379
  puts "Summary: #{mc.summary}"
372
380
  puts "Description:"
373
- puts mc.description
381
+ mc.description.each_line { |l| print " " ; puts l }
374
382
  else
375
383
  l = cmds_list.map { |k,v| [v,k] }
376
384
  puts "Metacommands:"
@@ -401,12 +409,24 @@ class Intar
401
409
 
402
410
  metacmd %w(q x quit exit), "Quit Intar", <<~EOT
403
411
  Leave Intar.
412
+
413
+ plain quit current Intar level
414
+ ! quit current loop
415
+ !! quit all levels
404
416
  EOT
405
417
  def cmd_quit x
406
418
  lx = $&.length.nonzero? if x =~ /!*/
407
419
  raise lx ? (lx > 1 ? Bye : Break) : Quit
408
420
  end
409
421
 
422
+ metacmd %w(c clear), "Clear command line", <<~EOT
423
+ Use this if a statement cannot be successfully ended,
424
+ i. e. when there is no other way to leave the dot prompt.
425
+ EOT
426
+ def cmd_clear x
427
+ raise Clear
428
+ end
429
+
410
430
  metacmd %w(cd), "Change directory", <<~EOT
411
431
  Switch to a different working directory.
412
432
  Former directories will be pushed to a stack.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intar
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.7'
4
+ version: '2.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-23 00:00:00.000000000 Z
11
+ date: 2022-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appl