File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -57,3 +57,19 @@ def load_auth():
57
57
click .echo ("No authentication found, trying default kubeconfig" )
58
58
except client .ApiException :
59
59
click .echo ("Invalid authentication, trying default kubeconfig" )
60
+
61
+
62
+ class PluralAlias (click .Group ):
63
+ def get_command (self , ctx , cmd_name ):
64
+ rv = click .Group .get_command (self , ctx , cmd_name )
65
+ if rv is not None :
66
+ return rv
67
+ for x in self .list_commands (ctx ):
68
+ if x + "s" == cmd_name :
69
+ return click .Group .get_command (self , ctx , x )
70
+ return None
71
+
72
+ def resolve_command (self , ctx , args ):
73
+ # always return the full command name
74
+ _ , cmd , args = super ().resolve_command (ctx , args )
75
+ return cmd .name , cmd , args
Original file line number Diff line number Diff line change 4
4
from codeflare_sdk .cluster .cluster import (
5
5
list_clusters_all_namespaces ,
6
6
list_all_clusters ,
7
- get_current_namespace ,
8
7
)
9
- from codeflare_sdk .cli .cli_utils import load_auth
8
+ from codeflare_sdk .cli .cli_utils import PluralAlias
10
9
11
10
12
- @click .group ()
11
+ @click .group (cls = PluralAlias )
13
12
def cli ():
14
13
"""List a specified resource"""
15
14
pass
@@ -19,7 +18,7 @@ def cli():
19
18
@click .option ("--namespace" , type = str )
20
19
@click .option ("--all" , is_flag = True )
21
20
@click .pass_context
22
- def rayclusters (ctx , namespace , all ):
21
+ def raycluster (ctx , namespace , all ):
23
22
"""List all rayclusters in a specified namespace"""
24
23
if all and namespace :
25
24
click .echo ("--all and --namespace are mutually exclusive" )
You can’t perform that action at this time.
0 commit comments