Skip to content

Commit

Permalink
feat(main): get config name from args
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Aug 13, 2020
1 parent 63878d3 commit e6857d7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"rollup-plugin-tslint": "0.2.2",
"rollup-plugin-typescript2": "0.27.2",
"rollup-plugin-uglify": "^6.0.4",
"rollup-plugin-virtual": "^1.0.1",
"rollup-plugin-visualizer": "^4.0.4",
"rollup-plugin-yaml": "2.0.0",
"sinon": "9.0.2",
Expand Down
6 changes: 6 additions & 0 deletions src/config/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface Parser<TData> {
}

export interface ParsedArgs {
config: string;
remote: string;
}

Expand All @@ -32,6 +33,11 @@ export function createParser(modeset: Modeback): Parser<ParsedArgs> {
handler: () => modeset(Commands.LABELS),
})
.options({
config: {
alias: ['c'],
demand: true,
type: 'string',
},
remote: {
alias: ['r'],
demand: true,
Expand Down
7 changes: 2 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ async function loadConfig(path: string): Promise<ConfigData> {
}

export async function main(argv: Array<string>): Promise<number> {
// get arguments
let mode = Commands.UNKNOWN as Commands;
const parser = createParser((argMode) => mode = argMode as Commands);
const args = parser.parse(argv.slice(SLICE_ARGS));
const config = await loadConfig('/home/ssube/.cautious-journey.yml');
const config = await loadConfig(args.config);
// TODO: create logger

/* eslint-disable-next-line no-console */
console.log({
Expand All @@ -56,9 +56,6 @@ export async function main(argv: Array<string>): Promise<number> {
version: VERSION_INFO,
});

// create logger
// create remote

for (const project of config.projects) {
const remote = new GithubRemote(project.remote);
await remote.connect();
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4474,11 +4474,6 @@ rollup-plugin-uglify@^6.0.4:
serialize-javascript "^2.1.2"
uglify-js "^3.4.9"

rollup-plugin-virtual@^1.0.1:
version "1.0.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-plugin-virtual/-/rollup-plugin-virtual-1.0.1.tgz#8227c94c605b981adfe433ea74de3551e42ffeb4"
integrity sha512-HCTBpV8MwP5lNzZrHD2moVxHIToHU1EkzkKGVj6Z0DcgUfxrxrZmeQirQeLz2yhnkJqRjwiVywK9CS8jDYakrw==

rollup-plugin-visualizer@^4.0.4:
version "4.1.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-plugin-visualizer/-/rollup-plugin-visualizer-4.1.0.tgz#92a1cebed30e7d39b3ab9db75426db06230edc5c"
Expand Down

0 comments on commit e6857d7

Please sign in to comment.