-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add main function, arg parsing for CLI
- Loading branch information
Showing
30 changed files
with
343 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [ResolveInput](./cautious-journey.resolveinput.md) > [flags](./cautious-journey.resolveinput.flags.md) | ||
|
||
## ResolveInput.flags property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
flags: Array<FlagLabel>; | ||
``` |
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [ResolveInput](./cautious-journey.resolveinput.md) > [labels](./cautious-journey.resolveinput.labels.md) | ||
|
||
## ResolveInput.labels property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
labels: Array<string>; | ||
``` |
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,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [ResolveInput](./cautious-journey.resolveinput.md) | ||
|
||
## ResolveInput interface | ||
|
||
Collected inputs for a resolver run. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ResolveInput | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [flags](./cautious-journey.resolveinput.flags.md) | Array<[FlagLabel](./cautious-journey.flaglabel.md)<!-- -->> | | | ||
| [labels](./cautious-journey.resolveinput.labels.md) | Array<string> | | | ||
| [states](./cautious-journey.resolveinput.states.md) | Array<[StateLabel](./cautious-journey.statelabel.md)<!-- -->> | | | ||
|
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [ResolveInput](./cautious-journey.resolveinput.md) > [states](./cautious-journey.resolveinput.states.md) | ||
|
||
## ResolveInput.states property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
states: Array<StateLabel>; | ||
``` |
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [ResolveResult](./cautious-journey.resolveresult.md) > [changes](./cautious-journey.resolveresult.changes.md) | ||
|
||
## ResolveResult.changes property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
changes: Array<ChangeRecord>; | ||
``` |
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [ResolveResult](./cautious-journey.resolveresult.md) > [errors](./cautious-journey.resolveresult.errors.md) | ||
|
||
## ResolveResult.errors property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
errors: Array<unknown>; | ||
``` |
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [ResolveResult](./cautious-journey.resolveresult.md) > [labels](./cautious-journey.resolveresult.labels.md) | ||
|
||
## ResolveResult.labels property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
labels: Array<string>; | ||
``` |
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,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [ResolveResult](./cautious-journey.resolveresult.md) | ||
|
||
## ResolveResult interface | ||
|
||
Collected results from a resolver run. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ResolveResult | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [changes](./cautious-journey.resolveresult.changes.md) | Array<ChangeRecord> | | | ||
| [errors](./cautious-journey.resolveresult.errors.md) | Array<unknown> | | | ||
| [labels](./cautious-journey.resolveresult.labels.md) | Array<string> | | | ||
|
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 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [StateChange](./cautious-journey.statechange.md) > [matches](./cautious-journey.statechange.matches.md) | ||
|
||
## StateChange.matches property | ||
|
||
Required labels for this state change to occur. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
matches: Array<LabelRef>; | ||
``` |
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,21 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [StateChange](./cautious-journey.statechange.md) | ||
|
||
## StateChange interface | ||
|
||
The transition between two state values. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface StateChange extends LabelSet | ||
``` | ||
<b>Extends:</b> LabelSet | ||
## Properties | ||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [matches](./cautious-journey.statechange.matches.md) | Array<LabelRef> | Required labels for this state change to occur. | | ||
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [StateValue](./cautious-journey.statevalue.md) > [becomes](./cautious-journey.statevalue.becomes.md) | ||
|
||
## StateValue.becomes property | ||
|
||
State changes that could occur to this value. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
becomes: Array<StateChange>; | ||
``` |
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,21 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [StateValue](./cautious-journey.statevalue.md) | ||
|
||
## StateValue interface | ||
|
||
One of many values for a particular state. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface StateValue extends BaseLabel | ||
``` | ||
<b>Extends:</b> BaseLabel | ||
## Properties | ||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [becomes](./cautious-journey.statevalue.becomes.md) | Array<[StateChange](./cautious-journey.statechange.md)<!-- -->> | State changes that could occur to this value. | | ||
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [SyncOptions](./cautious-journey.syncoptions.md) > [config](./cautious-journey.syncoptions.config.md) | ||
|
||
## SyncOptions.config property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
config: ConfigData; | ||
``` |
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,20 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [SyncOptions](./cautious-journey.syncoptions.md) | ||
|
||
## SyncOptions interface | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface SyncOptions | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [config](./cautious-journey.syncoptions.config.md) | ConfigData | | | ||
| [project](./cautious-journey.syncoptions.project.md) | string | | | ||
| [remote](./cautious-journey.syncoptions.remote.md) | [Remote](./cautious-journey.remote.md) | | | ||
|
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [SyncOptions](./cautious-journey.syncoptions.md) > [project](./cautious-journey.syncoptions.project.md) | ||
|
||
## SyncOptions.project property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
project: string; | ||
``` |
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [SyncOptions](./cautious-journey.syncoptions.md) > [remote](./cautious-journey.syncoptions.remote.md) | ||
|
||
## SyncOptions.remote property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
remote: Remote; | ||
``` |
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,26 @@ | ||
import { usage } from 'yargs'; | ||
|
||
import { VERSION_INFO } from '../version'; | ||
|
||
export function createParser() { | ||
let mode = ''; | ||
|
||
function handleMode(argi: string) { | ||
mode = argi; | ||
} | ||
|
||
/* eslint-disable-next-line sonarjs/prefer-immediate-return */ | ||
const parser = usage(`Usage: ${VERSION_INFO.package.name} <mode> [options]`) | ||
.command({ | ||
command: 'sync-issues', | ||
describe: '', | ||
handler: handleMode, | ||
}) | ||
.command({ | ||
command: 'sync-labels', | ||
describe: '', | ||
handler: handleMode, | ||
}); | ||
|
||
return parser; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,19 @@ | ||
export { FlagLabel, StateLabel } from './labels'; | ||
import { main } from './main'; | ||
|
||
export { FlagLabel, StateChange, StateLabel, StateValue } from './labels'; | ||
export { Remote, RemoteOptions } from './remote'; | ||
export { GithubRemote } from './remote/github'; | ||
export { GitlabRemote } from './remote/gitlab'; | ||
export { resolveLabels } from './resolve'; | ||
export { syncIssues, syncLabels } from './sync'; | ||
export { ResolveInput, ResolveResult, resolveLabels } from './resolve'; | ||
export { syncIssues, syncLabels, SyncOptions } from './sync'; | ||
|
||
const STATUS_ERROR = 1; | ||
|
||
/** | ||
* This is the main entry-point to the program and the only file not included in the main bundle. | ||
*/ | ||
main(process.argv).then((status) => process.exit(status)).catch((err: Error) => { | ||
// eslint-disable-next-line no-console | ||
console.error('uncaught error during main:', err); | ||
process.exit(STATUS_ERROR); | ||
}); |
Oops, something went wrong.