Skip to content

Commit ccce878

Browse files
committed
report only in cli.
1 parent 1ba3844 commit ccce878

4 files changed

Lines changed: 29 additions & 4 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2010-2019 Google, Inc. http://angularjs.org
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# tree-cli
22

3+
[![CircleCI](https://circleci.com/gh/MrRaindrop/tree-cli.svg?style=svg)](https://circleci.com/gh/MrRaindrop/tree-cli)
4+
![downloads](https://img.shields.io/npm/dm/tree-cli?style=flat-square)
5+
36
List contents of directories in tree-like format.
47

58
Tree-cli is a recursive directory listing program that produces a depth indented listing of files. With no arguments, tree lists the files in the current directory. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn. Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.
@@ -131,3 +134,4 @@ treee -l 2 -o out.txt -d
131134
* -i: makes tree not print the indentation lines, useful when used in conjunction with the -f option.
132135
* -l: max display depth of the directory tree.
133136
* -o: send output to filename.
137+

bin/tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ if (cli.flags.h) {
7171
cli.showHelp();
7272
}
7373

74-
genTree(cli.flags);
74+
genTree(cli.flags, true);

tree.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ var Promise = require('bluebird'),
446446

447447
},
448448

449-
run = function (flags) {
449+
run = function (flags, withCli) {
450450
return init(flags)
451451
.then(function () {
452452
var rootPath = path.resolve(_root, _flags.base);
@@ -461,15 +461,15 @@ var Promise = require('bluebird'),
461461
}
462462
}
463463

464-
if (!_flags.noreport) {
464+
if (!_flags.noreport && withCli) {
465465
console.log('\n' + _output(_report) + '\n');
466466
}
467467
if (!_flags.o) {
468468
return
469469
}
470470
return fs.writeFileAsync(_flags.o, _report)
471471
.then(function () {
472-
if (!_flags.noreport) {
472+
if (!_flags.noreport && withCli) {
473473
console.log('Finish writing to file:',
474474
path.resolve(_root, _flags.o),
475475
'\n\n'

0 commit comments

Comments
 (0)