Sha256: e04de5a5e1d6600e498bee90d44624e707c1b24ae4cf4c0a26f0e4a4c4dfc41d

Contents?: true

Size: 762 Bytes

Versions: 14

Compression:

Stored size: 762 Bytes

Contents

#!/bin/env ruby


require "Getopt/Declare"

shell_cmds = <<'EOCMDS';
Commands: [repeatable]

	echo [-n] <words:/.*/>	ECHO WITHOUT NEWLINE 
			{ print words; print "\n" unless _PUNCT_['-n'] }

	[pvtype: chwho /u?g?a?/]
	[pvtype: chwhat /r?w?x?/]

	chmod [-R] <who:chwho>=<what:chwhat> <files>...	
				CHANGE FILE PERMISSIONS 
                        { files.each { |i| print "chmod who=what #{i}\n" }
			}

	help			SHOW THIS SUMMARY 
			{ self.usage() }

	exit			EXIT SHELL 
			{ finish(1) }

	<error:/.*/>	 
			{ print "Unknown command: error\n";
			  print "(Try the 'help' command?)\n"; }
EOCMDS

shell = Getopt::Declare.new(shell_cmds,['-BUILD'])

# Pass a proc
count = 1
pt = proc {  print "#{count}> "; count += 1; return $stdin.readline }

shell.parse(pt)

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
getopt-declare-1.32 samples/demo_shell.rb
getopt-declare-1.31 samples/demo_shell.rb
getopt-declare-1.30 samples/demo_shell.rb
getopt-declare-1.29 samples/demo_shell.rb
getopt-declare-1.26 samples/demo_shell.rb
getopt-declare-1.27 samples/demo_shell.rb
getopt-declare-1.25 samples/demo_shell.rb
getopt-declare-1.28 samples/demo_shell.rb
getopt-declare-1.13 samples/demo_shell.rb
getopt-declare-1.23 samples/demo_shell.rb
getopt-declare-1.22 samples/demo_shell.rb
getopt-declare-1.21 samples/demo_shell.rb
getopt-declare-1.20 samples/demo_shell.rb
getopt-declare-1.12 samples/demo_shell.rb