Skip to content

Commit

Permalink
fix command file naming
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Oct 7, 2023
1 parent 04fee24 commit 36b70f2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
4 changes: 0 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
update ty
fix command file naming

ambr 'import { ty } from "@xieyuheng/ty"' 'import { ty } from "@xieyuheng/ty"'
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Command, CommandRunner } from "@xieyuheng/command-line"
import { ty } from "@xieyuheng/ty"
import { app } from "../../app/index.js"
import * as Commands from "../commands"
import * as Commands from "./index.js"

type Args = { path?: string }
type Opts = { help?: boolean; version?: boolean }

export class DefaultCommand extends Command<Args, Opts> {
export class Default extends Command<Args, Opts> {
name = "default"

description = "Run an file"
Expand Down Expand Up @@ -34,10 +34,10 @@ export class DefaultCommand extends Command<Args, Opts> {

if (path === undefined) {
const dir = process.cwd()
const command = new Commands.ReplCommand()
const command = new Commands.Repl()
await command.execute({ dir })
} else {
const command = new Commands.RunCommand()
const command = new Commands.Run()
await command.execute({ path })
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { app } from "../../app"

type Args = {}

export class ReplCommand extends Command<Args> {
export class Repl extends Command<Args> {
name = "repl"

description = "Open an interactive REPL"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { createURL } from "../../utils/createURL"
type Args = { path: string }
type Opts = {}

export class RunCommand extends Command<Args, Opts> {
export class Run extends Command<Args, Opts> {
name = "run"

description = "Run an inet program"
Expand Down
6 changes: 3 additions & 3 deletions src/command-line/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from "@xieyuheng/command-line/lib/commands"
export * from "./DefaultCommand"
export * from "./ReplCommand"
export * from "./RunCommand"
export * from "./Default"
export * from "./Repl"
export * from "./Run"
6 changes: 3 additions & 3 deletions src/command-line/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as Commands from "./commands"

export function createCommandRunner(): CommandRunner {
return new CommandRunners.CommonCommandRunner({
defaultCommand: new Commands.DefaultCommand(),
defaultCommand: new Commands.Default(),
commands: [
new Commands.ReplCommand(),
new Commands.RunCommand(),
new Commands.Repl(),
new Commands.Run(),
new Commands.CommonHelp(),
],
})
Expand Down

0 comments on commit 36b70f2

Please sign in to comment.