File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ ClapCompositeMatch >> at: identifierOrSpec [
23
23
ifAbsent: [
24
24
specification at: identifierOrSpec
25
25
ifPresent: [ :spec | ClapImplicit of: spec in: self ]
26
- ifAbsent: [ self notYetImplemented ] ]
26
+ ifAbsent: [ NotFound signal : ' Cannot find ' , identifierOrSpec asSymbol, ' ! ' ] ]
27
27
]
28
28
29
29
{ #category : #' accessing - children' }
@@ -71,6 +71,12 @@ ClapCompositeMatch >> flags [
71
71
^ children select: [ :each | specification flags includes: each specification ]
72
72
]
73
73
74
+ { #category : #testing }
75
+ ClapCompositeMatch >> hasChild [
76
+
77
+ ^ children isNotEmpty
78
+ ]
79
+
74
80
{ #category : #testing }
75
81
ClapCompositeMatch >> includesMatchOf: identifierOrSpec [
76
82
^ children anySatisfy: [ :arg | arg isMatchOf: identifierOrSpec ]
Original file line number Diff line number Diff line change @@ -232,6 +232,13 @@ ClapContext >> hasFlag: anIdentifier [
232
232
^ (self lastSubcommand occurrencesOf: anIdentifier) isNotEmpty
233
233
]
234
234
235
+ { #category : #private }
236
+ ClapContext >> hasPositional: aFlagMatch [
237
+
238
+ ^ aFlagMatch hasChild
239
+ and : [ aFlagMatch child specification isPositional ]
240
+ ]
241
+
235
242
{ #category : #activation }
236
243
ClapContext >> hasSessionChanged [
237
244
^ session ~~ Smalltalk session
@@ -287,7 +294,7 @@ ClapContext >> positional: anIdentifier [
287
294
identifierMatches := (self lastSubcommand occurrencesOf: anIdentifier)
288
295
select: [ :identifierMatch |
289
296
identifierMatch specification isPositional
290
- or : [ identifierMatch specification isFlag and : [ identifierMatch child specification isPositional ] ] ].
297
+ or : [ identifierMatch specification isFlag and : [ self hasPositional: identifierMatch ] ] ].
291
298
^ identifierMatches
292
299
ifEmpty: [ NotFound signal : ' No positional found with id: ' , anIdentifier ]
293
300
]
You can’t perform that action at this time.
0 commit comments