File tree Expand file tree Collapse file tree 2 files changed +32
-4
lines changed
Expand file tree Collapse file tree 2 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 1+ bin
2+ src
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3+ /**
4+ * Core dependencies.
5+ */
6+ var fs = require ( 'fs' ) ;
7+ var path = require ( 'path' ) ;
8+
39/**
410 * Notes.
511 *
@@ -14,10 +20,30 @@ var Notes = require('../lib/notes');
1420 */
1521var argv = process . argv . slice ( 2 , process . argv . length ) ;
1622
17- if ( 0 === argv . length ) {
18- return new Notes ( process . cwd ( ) ) . annotate ( ) ;
23+ /**
24+ * Current working directory.
25+ *
26+ * @type {String }
27+ */
28+ var cwd = process . cwd ( ) ;
29+
30+ /**
31+ * Runtime configurations path.
32+ *
33+ * @type {String }
34+ */
35+ var rc = path . join ( cwd , '.notesrc' ) ;
36+
37+ if ( 0 !== argv . length ) {
38+ return argv . forEach ( function ( arg ) {
39+ new Notes ( arg ) . annotate ( ) ;
40+ } ) ;
41+ }
42+
43+ if ( ! fs . existsSync ( rc ) ) {
44+ return new Notes ( cwd ) . annotate ( ) ;
1945}
2046
21- argv . forEach ( function ( arg ) {
22- new Notes ( arg ) . annotate ( ) ;
47+ fs . readFileSync ( rc , 'utf8' ) . trim ( ) . split ( / \s + / ) . forEach ( function ( directory ) {
48+ new Notes ( directory ) . annotate ( ) ;
2349} ) ;
You can’t perform that action at this time.
0 commit comments