Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mkusaka committed May 1, 2022
1 parent 9c7d013 commit 01d7e7a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 7 deletions.
8 changes: 5 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Command, Base64 } from "./deps.ts";
import { workflow } from "./subCommands/workflow.ts";
import { workflow, name as workflowName } from "./subCommands/workflow.ts";
import { pipeline, name as pipelineName } from "./subCommands/pipeline.ts";
import { ENV_CIRCLECI_TOKEN } from "./env.ts";
import { OpenAPI } from "./client/index.ts";
import packageJson from "./package.json" assert { type: "json" };
Expand All @@ -13,8 +14,9 @@ OpenAPI.HEADERS = {
};

await new Command()
.name("circli")
.name(packageJson.name)
.version(packageJson.version)
.description("circleci cli")
.command("workflow", workflow)
.command(workflowName, workflow)
.command(pipelineName, pipeline)
.parse(Deno.args);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "circli",
"description": "cli which implements useful command for circleci",
"version": "0.0.9",
"main": "index.js",
"repository": "https://github.com/mkusaka/circli.git",
Expand Down
7 changes: 7 additions & 0 deletions subCommands/pipeline.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Command } from "../deps.ts";
import { cancel, name as cancelName } from "./pipeline/cancel.ts";

export const name = "pipeline";
export const pipeline = await new Command()
.description("pipeline command")
.command(cancelName, cancel);
1 change: 1 addition & 0 deletions subCommands/pipeline/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const defaultOrRequiredWorkflowId = () => {
} as const;
};

export const name = "cancel":
export const cancel = await new Command()
.description("cancel redundant workflow")
.option(
Expand Down
12 changes: 8 additions & 4 deletions subCommands/workflow.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { Command } from "../deps.ts";
import { cancelRedundant } from "./workflow/cancelRedundant.ts";
import { cancel } from "./workflow/cancel.ts";
import {
cancelRedundant,
name as cancelRedundantName,
} from "./workflow/cancelRedundant.ts";
import { cancel, name as cancelName } from "./workflow/cancel.ts";

export const name = "workflow";
export const workflow = await new Command()
.description("workflow command")
.command("cancel_redundant", cancelRedundant)
.command("cancel", cancel);
.command(cancelRedundantName, cancelRedundant)
.command(cancelName, cancel);
1 change: 1 addition & 0 deletions subCommands/workflow/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const defaultOrRequiredWorkflowId = () => {
} as const;
};

export const name = "cancel";
export const cancel = await new Command()
.description("cancel redundant workflow")
.option(
Expand Down
1 change: 1 addition & 0 deletions subCommands/workflow/cancelRedundant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const defaultOrRequiredRepoName = () => {
} as const;
};

export const name = "cancel_redundant";
export const cancelRedundant = await new Command()
.description("cancel redundant workflow")
.option(
Expand Down

0 comments on commit 01d7e7a

Please sign in to comment.