@@ -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,29 +59,13 @@ class CommandGet extends CommandPolykey {
6459 ( auth ) => pkClient . grpcClient . vaultsSecretsGet ( secretMessage , auth ) ,
6560 meta ,
6661 ) ;
67- const secretContent = Buffer . from ( response . getSecretContent_asU8 ( ) )
68- . toString ( 'utf-8' )
69- . trim ( ) ;
70- if ( isEnv ) {
71- process . stdout . write (
72- binUtils . outputFormatter ( {
73- type : options . format === 'json' ? 'json' : 'list' ,
74- data : [
75- `Export ${ secretMessage
76- . getSecretName ( )
77- . toUpperCase ( )
78- . replace ( '-' , '_' ) } ='${ secretContent } '`,
79- ] ,
80- } ) ,
81- ) ;
82- } else {
83- process . stdout . write (
84- binUtils . outputFormatter ( {
85- type : options . format === 'json' ? 'json' : 'list' ,
86- data : [ `${ secretMessage . getSecretName ( ) } : ${ secretContent } ` ] ,
87- } ) ,
88- ) ;
89- }
62+ const secretContent = response . getSecretContent_asU8 ( ) ;
63+ process . stdout . write (
64+ binUtils . outputFormatter ( {
65+ type : 'raw' ,
66+ data : secretContent ,
67+ } ) ,
68+ ) ;
9069 } finally {
9170 if ( pkClient ! != null ) await pkClient . stop ( ) ;
9271 }
0 commit comments