1
0
Fork 0

feat(main): add project option, use to filter project sync

This commit is contained in:
ssube 2020-08-15 09:52:08 -05:00
parent 7bb4e95875
commit e4ab01ad10
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
8 changed files with 30 additions and 18 deletions

View File

@ -9,7 +9,7 @@ Individual labels: the equivalent of a checkbox.
<b>Signature:</b> <b>Signature:</b>
```typescript ```typescript
export interface FlagLabel extends BaseLabel, LabelSet export interface FlagLabel extends BaseLabel, ChangeSet
``` ```
<b>Extends:</b> BaseLabel, LabelSet <b>Extends:</b> BaseLabel, ChangeSet

View File

@ -9,9 +9,9 @@ The transition between two state values.
<b>Signature:</b> <b>Signature:</b>
```typescript ```typescript
export interface StateChange extends LabelSet export interface StateChange extends ChangeSet
``` ```
<b>Extends:</b> LabelSet <b>Extends:</b> ChangeSet
## Properties ## Properties

View File

@ -9,9 +9,9 @@ Grouped labels: the equivalent of a radio group.
<b>Signature:</b> <b>Signature:</b>
```typescript ```typescript
export interface StateLabel extends BaseLabel, LabelSet export interface StateLabel extends BaseLabel, ChangeSet
``` ```
<b>Extends:</b> BaseLabel, LabelSet <b>Extends:</b> BaseLabel, ChangeSet
## Properties ## Properties

View File

@ -21,9 +21,9 @@ This guide explains how to start using `cautious-journey` to manage project and
- [Commands](#commands) - [Commands](#commands)
- [Sync Labels](#sync-labels) - [Sync Labels](#sync-labels)
- [Sync Issues](#sync-issues) - [Sync Issues](#sync-issues)
- [Transitions](#transitions) - [Changes](#changes)
- [Flag Transitions](#flag-transitions) - [Flag Changes](#flag-changes)
- [State Transitions](#state-transitions) - [State Changes](#state-changes)
## Setup ## Setup
@ -83,12 +83,12 @@ TODO: what happens when you sync the project labels?
TODO: what happens when you sync the issue labels? TODO: what happens when you sync the issue labels?
## Transitions ## Changes
### Flag Transitions ### Flag Changes
TODO: how are flag labels added and removed? TODO: how are flag labels added and removed?
### State Transitions ### State Changes
TODO: how are state labels added and removed? TODO: how are state labels added and removed?

View File

@ -15,6 +15,7 @@ interface Parser<TData> {
export interface ParsedArgs { export interface ParsedArgs {
config: string; config: string;
dryrun: boolean; dryrun: boolean;
project?: Array<string>;
remote: string; remote: string;
} }
@ -45,6 +46,12 @@ export function createParser(modeset: Modeback): Parser<ParsedArgs> {
demand: false, demand: false,
type: 'boolean', type: 'boolean',
}, },
project: {
alias: ['p'],
array: true,
demand: false,
type: 'string',
},
remote: { remote: {
alias: ['r'], alias: ['r'],
demand: true, demand: true,

View File

@ -8,7 +8,7 @@ export interface LabelRef {
/** /**
* A set of labels to add and/or remove. * A set of labels to add and/or remove.
*/ */
export interface LabelSet { export interface ChangeSet {
adds: Array<LabelRef>; adds: Array<LabelRef>;
removes: Array<LabelRef>; removes: Array<LabelRef>;
} }
@ -34,14 +34,14 @@ export interface BaseLabel {
/** /**
* Individual labels: the equivalent of a checkbox. * Individual labels: the equivalent of a checkbox.
*/ */
export interface FlagLabel extends BaseLabel, LabelSet { export interface FlagLabel extends BaseLabel, ChangeSet {
/* empty */ /* empty */
} }
/** /**
* The transition between two state values. * The transition between two state values.
*/ */
export interface StateChange extends LabelSet { export interface StateChange extends ChangeSet {
/** /**
* Required labels for this state change to occur. * Required labels for this state change to occur.
*/ */
@ -61,7 +61,7 @@ export interface StateValue extends BaseLabel {
/** /**
* Grouped labels: the equivalent of a radio group. * Grouped labels: the equivalent of a radio group.
*/ */
export interface StateLabel extends BaseLabel, LabelSet { export interface StateLabel extends BaseLabel, ChangeSet {
/** /**
* Values for this state. * Values for this state.
*/ */

View File

@ -1,4 +1,4 @@
import { InvalidArgumentError, isNil } from '@apextoaster/js-utils'; import { InvalidArgumentError, isNil, doesExist } from '@apextoaster/js-utils';
import { createSchema } from '@apextoaster/js-yaml-schema'; import { createSchema } from '@apextoaster/js-yaml-schema';
import { existsSync, readFileSync, realpathSync } from 'fs'; import { existsSync, readFileSync, realpathSync } from 'fs';
import { DEFAULT_SAFE_SCHEMA, safeLoad } from 'js-yaml'; import { DEFAULT_SAFE_SCHEMA, safeLoad } from 'js-yaml';
@ -57,6 +57,11 @@ export async function main(argv: Array<string>): Promise<number> {
}, 'startup environment'); }, 'startup environment');
for (const project of config.projects) { for (const project of config.projects) {
if (doesExist(args.project) && !args.project.includes(project.name)) {
logger.info({ project: project.name }, 'skipping project');
continue;
}
const remote = new GithubRemote({ const remote = new GithubRemote({
...project.remote, ...project.remote,
dryrun: args.dryrun, dryrun: args.dryrun,

View File

@ -18,7 +18,7 @@ export class GithubRemote implements Remote {
constructor(options: RemoteOptions) { constructor(options: RemoteOptions) {
this.options = options; this.options = options;
options.logger.debug({ options }, 'github remote'); options.logger.debug(options, 'github remote');
} }
public async connect() { public async connect() {