File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -779,7 +779,9 @@ class BoxCommand extends Command {
779779 * @returns {void }
780780 */
781781 info ( content ) {
782- process . stderr . write ( `${ content } ${ os . EOL } ` ) ;
782+ if ( ! this . flags . quiet ) {
783+ process . stderr . write ( `${ content } ${ os . EOL } ` ) ;
784+ }
783785 }
784786
785787 /**
@@ -1131,12 +1133,17 @@ BoxCommand.flags = {
11311133 char : 'y' ,
11321134 description : 'Automatically respond yes to all confirmation prompts' ,
11331135 } ) ,
1136+ quiet : flags . boolean ( {
1137+ char : 'q' ,
1138+ description : 'Suppress any non-error output to stderr' ,
1139+ } )
11341140} ;
11351141
11361142BoxCommand . minFlags = _ . pick ( BoxCommand . flags , [
11371143 'no-color' ,
11381144 'help' ,
1139- 'verbose'
1145+ 'verbose' ,
1146+ 'quiet'
11401147] ) ;
11411148
11421149module . exports = BoxCommand ;
Original file line number Diff line number Diff line change @@ -243,6 +243,22 @@ describe('Files', () => {
243243 assert . equal ( ctx . stderr , `Deleted file ${ fileId } ${ os . EOL } ` ) ;
244244 } ) ;
245245
246+ test
247+ . nock ( TEST_API_ROOT , api => api
248+ . delete ( `/2.0/files/${ fileId } ` )
249+ . reply ( 204 )
250+ )
251+ . stderr ( )
252+ . command ( [
253+ 'files:delete' ,
254+ fileId ,
255+ '--quiet' ,
256+ '--token=test' ,
257+ ] )
258+ . it ( 'should delete a file, but output no information to stderr' , ctx => {
259+ assert . equal ( ctx . stderr , '' ) ;
260+ } ) ;
261+
246262 test
247263 . nock ( TEST_API_ROOT , api => api
248264 . delete ( `/2.0/files/${ fileId } ` )
You can’t perform that action at this time.
0 commit comments