mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 06:36:08 +03:00
21 lines
545 B
TypeScript
21 lines
545 B
TypeScript
|
// Loaded from https://deno.land/x/cliffy@v0.18.0/command/types/action_list.ts
|
||
|
|
||
|
|
||
|
import type { Command } from "../command.ts";
|
||
|
import { StringType } from "./string.ts";
|
||
|
|
||
|
/** Completion list type. */
|
||
|
export class ActionListType extends StringType {
|
||
|
constructor(protected cmd: Command) {
|
||
|
super();
|
||
|
}
|
||
|
|
||
|
/** Complete action names. */
|
||
|
public complete(): string[] {
|
||
|
return this.cmd.getCompletions()
|
||
|
.map((type) => type.name)
|
||
|
// filter unique values
|
||
|
.filter((value, index, self) => self.indexOf(value) === index);
|
||
|
}
|
||
|
}
|