Skip to content

Commit

Permalink
fix fcli dir not exist when first use (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhe123 committed Jun 30, 2018
1 parent b4282fd commit 4200653
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/commands/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const inquirer = require('inquirer');
const path = require('path');
const yaml = require('js-yaml');
const util = require('util');
const mkdirp = require('mkdirp');

const getProfile = require('../profile').getProfileFromFile;

Expand Down Expand Up @@ -46,7 +47,11 @@ async function config() {
];

const newProf = await inquirer.prompt(questions);
const profPath = path.join(os.homedir(), '.fcli/config.yaml');
const configDir = path.join(os.homedir(), '.fcli');

await mkdirp(configDir);

const profPath = path.join(configDir, 'config.yaml');
const isExists = await exists(profPath);

var profYml;
Expand All @@ -72,9 +77,6 @@ async function config() {
};
}




await writeFile(profPath, yaml.dump(profYml));

}
Expand Down

0 comments on commit 4200653

Please sign in to comment.