intar 2.6 → 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 +32 -10
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bb2575fd8680cb18e04afcd3a09adb4565bc5ac37a4231db3b3b57e80074c6c
4
- data.tar.gz: 8d2bf0a511a093e2b3d6feb8922a1da6466ce44ef0b77f016862f8d91e0f98dd
3
+ metadata.gz: 353105e4252052ef911b05ead40920c09770699711c077f6a0f5ea7cb3c2347e
4
+ data.tar.gz: 3e4c7bbacccbc4fac8b3502ce32e86975cd613c7683de3e119aee3b89dcbeeb9
5
5
  SHA512:
6
- metadata.gz: 3c22c8280845f8c99896196b9548ee0043fd5378d8d1da2f8c8c011f490e4dc342c638572935cac04e3815a5d03f9561e961a5cd515d3efc7f439d86bac446af
7
- data.tar.gz: 054dc4d33647bf5aa286feb9b014610529de8051cfa5342f428b5a65e34175567c1eb786de38103a009a25e2ac0cf3627bfa1950b12530c3d44f7862c21e3de8
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.6".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,22 +108,26 @@ 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
- @redir.redirect_output do eval l, @binding, @file end
116
+ begin
117
+ r = eval_line l
118
+ rescue SyntaxError
119
+ raise if l.end_with? $/
120
+ @previous = l
121
+ end
116
122
  end
123
+ next if @previous
124
+ rescue Clear
125
+ @previous = nil
117
126
  rescue Bye
118
127
  raise if @depth.nonzero?
119
128
  break
120
129
  rescue Quit
121
130
  break
122
- rescue SyntaxError
123
- raise if l.end_with? $/
124
- @previous = l
125
- next
126
131
  rescue Exception
127
132
  break if SystemExit === $! and not @params[ :catch_exit]
128
133
  show_exception
@@ -143,6 +148,11 @@ class Intar
143
148
 
144
149
  private
145
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
+
146
156
  def handle_history
147
157
  unless @depth.nonzero? then
148
158
  begin
@@ -368,7 +378,7 @@ class Intar
368
378
  puts "Metacommand: #{names.join ' '}"
369
379
  puts "Summary: #{mc.summary}"
370
380
  puts "Description:"
371
- puts mc.description
381
+ mc.description.each_line { |l| print " " ; puts l }
372
382
  else
373
383
  l = cmds_list.map { |k,v| [v,k] }
374
384
  puts "Metacommands:"
@@ -399,12 +409,24 @@ class Intar
399
409
 
400
410
  metacmd %w(q x quit exit), "Quit Intar", <<~EOT
401
411
  Leave Intar.
412
+
413
+ plain quit current Intar level
414
+ ! quit current loop
415
+ !! quit all levels
402
416
  EOT
403
417
  def cmd_quit x
404
418
  lx = $&.length.nonzero? if x =~ /!*/
405
419
  raise lx ? (lx > 1 ? Bye : Break) : Quit
406
420
  end
407
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
+
408
430
  metacmd %w(cd), "Change directory", <<~EOT
409
431
  Switch to a different working directory.
410
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.6'
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