We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9dee398 commit a7ec7c9Copy full SHA for a7ec7c9
lib/location.js
@@ -4,9 +4,28 @@
4
* tries to find the location of the database.
5
*
6
*/
7
+
8
module.exports = function (argv) {
9
10
var location = typeof argv.location === 'string';
- argv.path = location && argv.location || argv._[0] || process.cwd();
11
+ argv.path = location && argv.location || argv._[0];
12
+ if (!argv.path) {
13
+ if (cwdIsADatabase()) {
14
+ argv.path = process.cwd();
15
+ }
16
+ else {
17
+ console.error('no database found');
18
+ return process.exit(1);
19
+ };
20
21
+};
22
23
+function cwdIsADatabase () {
24
+ try {
25
+ var CURRENT = require('fs').readFileSync('./CURRENT').toString();
26
+ return CURRENT.split('-')[0] === 'MANIFEST';
27
+ } catch (err) {
28
+ return false;
29
30
};
31
0 commit comments