@@ -15,10 +15,6 @@ class CommandGet extends CommandPolykey {
1515 'Path to where the secret to be retrieved, specified as <vaultName>:<directoryPath>' ,
1616 parsers . parseSecretPath ,
1717 ) ;
18- this . option (
19- '-e, --env' ,
20- 'Wrap the secret in an environment variable declaration' ,
21- ) ;
2218 this . addOption ( binOptions . nodeId ) ;
2319 this . addOption ( binOptions . clientHost ) ;
2420 this . addOption ( binOptions . clientPort ) ;
@@ -54,7 +50,6 @@ class CommandGet extends CommandPolykey {
5450 port : clientOptions . clientPort ,
5551 logger : this . logger . getChild ( PolykeyClient . name ) ,
5652 } ) ;
57- const isEnv : boolean = options . env ?? false ;
5853 const secretMessage = new secretsPB . Secret ( ) ;
5954 const vaultMessage = new vaultsPB . Vault ( ) ;
6055 vaultMessage . setNameOrId ( secretPath [ 0 ] ) ;
@@ -64,28 +59,13 @@ class CommandGet extends CommandPolykey {
6459 ( auth ) => pkClient . grpcClient . vaultsSecretsGet ( secretMessage , auth ) ,
6560 meta ,
6661 ) ;
67- if ( isEnv ) {
68- process . stdout . write (
69- binUtils . outputFormatter ( {
70- type : options . format === 'json' ? 'json' : 'list' ,
71- data : [
72- `Export ${ secretMessage
73- . getSecretName ( )
74- . toUpperCase ( )
75- . replace ( '-' , '_' ) } ='${ response . getSecretName ( ) } `,
76- ] ,
77- } ) ,
78- ) ;
79- } else {
80- process . stdout . write (
81- binUtils . outputFormatter ( {
82- type : options . format === 'json' ? 'json' : 'list' ,
83- data : [
84- `${ secretMessage . getSecretName ( ) } :\t\t${ response . getSecretName ( ) } ` ,
85- ] ,
86- } ) ,
87- ) ;
88- }
62+ const secretContent = response . getSecretContent_asU8 ( ) ;
63+ process . stdout . write (
64+ binUtils . outputFormatter ( {
65+ type : 'raw' ,
66+ data : secretContent ,
67+ } ) ,
68+ ) ;
8969 } finally {
9070 if ( pkClient ! != null ) await pkClient . stop ( ) ;
9171 }
0 commit comments