-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcommonCommandExample.stone
executable file
·86 lines (81 loc) · 2.98 KB
/
commonCommandExample.stone
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env superdoit_stone
#
# Example script with the commonly used superdoit commands
#
options
{
SuperDoitOptionalOptionWithNoArg long: 'noArg'.
SuperDoitOptionalOptionWithNoArg long: 'noArg' short: 'n'.
SuperDoitOptionalOptionWithRequiredArg long: 'optional'.
SuperDoitOptionalOptionWithRequiredArg long: 'optional' default: 'default'.
SuperDoitOptionalOptionWithRequiredArg long: 'optional' short: 'o'.
SuperDoitOptionalOptionWithRequiredArg long: 'optional' short: 'o' default: 'default'.
SuperDoitRequiredOptionWithRequiredArg long: 'required'.
SuperDoitRequiredOptionWithRequiredArg long: 'required' short: 'r'.
}
%
usage
-----
USAGE
# with GS_HOME set (<stone-name> optional if run in $GS_HOME/servers/stones/<stone-name> directory)
$basename [--help | -h] [--debug | -D] [-- [<stone-name> [<topaz-command-line-args>] ] ]
# with GEMSTONE set
$basename [--help | -h] [--debug | -D] -- ([-r] | -l | -L) -I <path-to-.topazini> [<topaz-command-line-args>]
DESCRIPTION
Example script demonstrating the most common commands:
options
usage
instvars
method
doit
OPTIONS
<stone-name> Name of the GsDevKit_home stone. <stone-name> argument
may be skipped if the script is run in a GsDevKit_home
stone directory (i.e., $GS_HOME/server/stones/<stone-name>
<topaz-command-line-args> topaz options that should be passed to topaz when running
running the script
-h, --help display usage message
-D, --debug bring up topaz debugger in the event of a script error
--noArg | -n option with no argument
--optional | -o optional option with required argument
EXAMPLES
$basename --help -- gs_351 # with GS_HOME set
$basename -h -- -l -I ./.topazini # with GEMSTONE set
$basename --help <topaz-arguments>
$basename -D --required=arg <topaz-arguments>
$basename --required=arg <topaz-arguments>
$basename --required=arg --noArg <topaz-arguments>
$basename --required=arg --optional="non default" <topaz-arguments>
$basename --required=arg -o non-default <topaz-arguments>
$basename --required=arg -n -o non-default <topaz-arguments>
-----
%
instvars
instvar
%
method
foo
^ instvar
%
method
testDoPerist: doPersist doExport: doExport
doPersist ifTrue: [
self persist
].
doExport ifTrue: [
self class export
].
^ self noResult
%
doit
self testDoPerist: true doExport: true.
self stdout nextPutAll: '--required present with value ', self required printString; lf.
self noArg
ifTrue: [
self stdout nextPutAll: '--noArg present'; lf ].
self optional
ifNotNil: [:optionalValue |
self stdout nextPutAll: '--optional present with value ', optionalValue printString; lf ].
instvar := self required.
^ self foo
%