-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added support for named start (#768)
Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
- Loading branch information
1 parent
0512edd
commit 701b125
Showing
9 changed files
with
152 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const {SystemError} = require('../errors'); | ||
const findValidInstallation = require('./find-valid-install'); | ||
|
||
/** | ||
* @param {object} options | ||
* @param {string} options.name | ||
* @param {import('../system.js')} options.system | ||
* @param {string} options.command | ||
* @param {boolean} options.recurse | ||
*/ | ||
function getInstance({ | ||
name: instanceName, | ||
system, | ||
command: commandName, | ||
recurse | ||
}) { | ||
if (instanceName) { | ||
const instance = system.getInstance(instanceName); | ||
if (!instance) { | ||
throw new SystemError(`Ghost instance '${instanceName}' does not exist`); | ||
} | ||
|
||
process.chdir(instance.dir); | ||
return instance; | ||
} | ||
|
||
findValidInstallation(commandName, recurse); | ||
return system.getInstance(); | ||
} | ||
|
||
module.exports = getInstance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.