File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -926,7 +926,16 @@ def vars():
926
926
927
927
def parse_envvars (ctx , name , value : list [str ]) -> dict [str , str ]:
928
928
def parse_envar (item : str ):
929
- if not ("=" in item and len (item .split ("=" )) == 2 ):
929
+
930
+ if "=" not in item :
931
+ if not (envvar := os .environ .get (item )):
932
+ raise click .UsageError (
933
+ f"Environment variable '{ item } ' has no value in your environment"
934
+ )
935
+
936
+ return item , envvar
937
+
938
+ elif len (item .split ("=" )) != 2 :
930
939
raise click .UsageError (f"Value '{ item } ' must be in form `NAME=VAL`" )
931
940
932
941
return item .split ("=" )
@@ -941,9 +950,9 @@ def parse_envar(item: str):
941
950
"variables" ,
942
951
multiple = True ,
943
952
type = str ,
944
- metavar = "NAME=VAL" ,
953
+ metavar = "NAME[ =VAL] " ,
945
954
callback = parse_envvars ,
946
- help = "Environment variable key and value to add (Multiple allowed)" ,
955
+ help = "Environment variable name or key and value to add (Multiple allowed)" ,
947
956
)
948
957
@click .argument ("name" )
949
958
@cluster_client ()
@@ -988,9 +997,9 @@ def vargroup_info(cluster: "ClusterClient", name: str):
988
997
"updated_vars" ,
989
998
multiple = True ,
990
999
type = str ,
991
- metavar = "NAME=VAL" ,
1000
+ metavar = "NAME[ =VAL] " ,
992
1001
callback = parse_envvars ,
993
- help = "Environment variable key and value to add/update (Multiple allowed)" ,
1002
+ help = "Environment variable name or key and value to add/update (Multiple allowed)" ,
994
1003
)
995
1004
@click .option (
996
1005
"-d" ,
You can’t perform that action at this time.
0 commit comments