Skip to content

Commit

Permalink
Closes #4, Added ability to set different editor for specific project…
Browse files Browse the repository at this point in the history
…s through >>> Opening settings.json ✔
  • Loading branch information
saurabhdaware committed Sep 7, 2019
1 parent 212b0df commit fe48149
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function writeSettings(data, command='<command>', successMessage = "Settings upd

//

// oncmd: projectman open [projectName]
// projectman open [projectName]
async function openProject(projectName){
let selectedProject;
if(settings.projects.length == 0){
Expand Down Expand Up @@ -100,7 +100,9 @@ async function openProject(projectName){
return;
}

const {stderr} = await exec(`${settings.commandToOpen} "${selectedProject.path}"`);
const commandToOpen = selectedProject.editor || settings.commandToOpen;

const {stderr} = await exec(`${commandToOpen} "${selectedProject.path}"`);
if(stderr){
console.error("Could not open project for some reason :(");
throwCreateIssueError(stderr);
Expand All @@ -111,6 +113,7 @@ async function openProject(projectName){

}

// pm seteditor [command]
async function setEditor(command){
let commandToOpen;
if(!command){
Expand Down Expand Up @@ -169,6 +172,7 @@ async function addProject(projectDirectory = '.'){
writeSettings(settings, 'add', "Project Added");
}

// pm remove [projectName]
async function removeProject(projectName){
let selectedProjectName;
if(!projectName){
Expand Down

0 comments on commit fe48149

Please sign in to comment.