-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from idearium/apple-silicon
Apple silicon
- Loading branch information
Showing
31 changed files
with
469 additions
and
63 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,9 @@ | ||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { exec } = require('shelljs'); | ||
|
||
// The basic program, which uses sub-commands. | ||
program.parse(process.argv); | ||
|
||
exec('docker image prune'); |
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,8 @@ | ||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { missingCommand } = require('./lib/c'); | ||
|
||
program.command('prune', 'Removes unused dangling images.').parse(process.argv); | ||
|
||
missingCommand(program); |
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,34 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { | ||
loadState, | ||
devspacePath, | ||
newline, | ||
reportError, | ||
stateFilePath, | ||
} = require('./lib/c'); | ||
|
||
program | ||
.option('-n', 'Do not print the trailing newline character.') | ||
.parse(process.argv); | ||
|
||
return loadState('handle', stateFilePath(devspacePath())) | ||
.then((data) => { | ||
process.stdout.write(`${data}${newline(program.N)}`); | ||
}) | ||
.catch((err) => { | ||
if (err.code === 'ENOENT') { | ||
return reportError( | ||
new Error( | ||
"Your handle hasn't been configured yet. Use `c ds handle set <handle>`." | ||
), | ||
false, | ||
true | ||
); | ||
} | ||
|
||
return reportError(err, false, true); | ||
}); |
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,39 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { | ||
devspacePath, | ||
reportError, | ||
stateFilePath, | ||
storeState, | ||
} = require('./lib/c'); | ||
|
||
program | ||
.arguments('<handle>') | ||
.description('Set your Idearium handle.') | ||
.parse(process.argv); | ||
|
||
const [handle] = program.args; | ||
|
||
if (!handle) { | ||
return reportError( | ||
new Error('You must provide your Idearium handle.'), | ||
program | ||
); | ||
} | ||
|
||
const run = async () => { | ||
const file = stateFilePath(devspacePath()); | ||
|
||
try { | ||
await storeState('handle', handle, file); | ||
await storeState('mkName', `${handle}-minikube`, file); | ||
await storeState('pcName', `${handle}-pc`, file); | ||
} catch (err) { | ||
reportError(err, program, true); | ||
} | ||
}; | ||
|
||
run(); |
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,13 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { missingCommand } = require('./lib/c'); | ||
|
||
program | ||
.command('get', 'Get your handle.') | ||
.command('set <handle>', 'Set your handle.') | ||
.parse(process.argv); | ||
|
||
missingCommand(program); |
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,34 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { | ||
loadState, | ||
devspacePath, | ||
newline, | ||
reportError, | ||
stateFilePath, | ||
} = require('./lib/c'); | ||
|
||
program | ||
.option('-n', 'Do not print the trailing newline character.') | ||
.parse(process.argv); | ||
|
||
return loadState('mkName', stateFilePath(devspacePath())) | ||
.then((data) => { | ||
process.stdout.write(`${data}${newline(program.N)}`); | ||
}) | ||
.catch((err) => { | ||
if (err.code === 'ENOENT') { | ||
return reportError( | ||
new Error( | ||
"Your Minikube name hasn't been configured yet. Use `c ds mk set <minikube-name>`." | ||
), | ||
false, | ||
true | ||
); | ||
} | ||
|
||
return reportError(err, false, true); | ||
}); |
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,35 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { | ||
devspacePath, | ||
reportError, | ||
stateFilePath, | ||
storeState, | ||
} = require('./lib/c'); | ||
|
||
program | ||
.arguments('<mk-name>') | ||
.description("Set your Minikube's name.") | ||
.parse(process.argv); | ||
|
||
const [name] = program.args; | ||
|
||
if (!name) { | ||
return reportError( | ||
new Error("You must provide your Minikube's name."), | ||
program | ||
); | ||
} | ||
|
||
const run = async () => { | ||
try { | ||
await storeState('mkName', name, stateFilePath(devspacePath())); | ||
} catch (err) { | ||
reportError(err, program, true); | ||
} | ||
}; | ||
|
||
run(); |
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,13 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { missingCommand } = require('./lib/c'); | ||
|
||
program | ||
.command('get', 'Get your Minikube name.') | ||
.command('set <minikube-name>', 'Set your Minikube name.') | ||
.parse(process.argv); | ||
|
||
missingCommand(program); |
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,34 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { | ||
loadState, | ||
devspacePath, | ||
newline, | ||
reportError, | ||
stateFilePath, | ||
} = require('./lib/c'); | ||
|
||
program | ||
.option('-n', 'Do not print the trailing newline character.') | ||
.parse(process.argv); | ||
|
||
return loadState('pcName', stateFilePath(devspacePath())) | ||
.then((data) => { | ||
process.stdout.write(`${data}${newline(program.N)}`); | ||
}) | ||
.catch((err) => { | ||
if (err.code === 'ENOENT') { | ||
return reportError( | ||
new Error( | ||
"Your pc name hasn't been configured yet. Use `c ds pc set <pc-name>`." | ||
), | ||
false, | ||
true | ||
); | ||
} | ||
|
||
return reportError(err, false, true); | ||
}); |
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,35 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { | ||
devspacePath, | ||
reportError, | ||
stateFilePath, | ||
storeState, | ||
} = require('./lib/c'); | ||
|
||
program | ||
.arguments('<pc-name>') | ||
.description("Set your pc's name.") | ||
.parse(process.argv); | ||
|
||
const [name] = program.args; | ||
|
||
if (!name) { | ||
return reportError( | ||
new Error("You must provide your computer's name."), | ||
program | ||
); | ||
} | ||
|
||
const run = async () => { | ||
try { | ||
await storeState('pcName', name, stateFilePath(devspacePath())); | ||
} catch (err) { | ||
reportError(err, program, true); | ||
} | ||
}; | ||
|
||
run(); |
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,13 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { missingCommand } = require('./lib/c'); | ||
|
||
program | ||
.command('get', 'Get your pc name.') | ||
.command('set <pc-name>', 'Set your pc name.') | ||
.parse(process.argv); | ||
|
||
missingCommand(program); |
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,14 @@ | ||
#!/usr/bin/env -S node --trace-warnings | ||
|
||
'use strict'; | ||
|
||
const program = require('commander'); | ||
const { missingCommand } = require('./lib/c'); | ||
|
||
program | ||
.command('handle', 'Manage your Idearium handle.') | ||
.command('mk', 'Manage your Minikube name.') | ||
.command('pc', 'Manager your computer name.') | ||
.parse(process.argv); | ||
|
||
missingCommand(program); |
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.