mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +00:00
Remove unused code
Change-type: patch
This commit is contained in:
parent
003d537433
commit
0f23318367
@ -15,41 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { OptionDefinition } from 'capitano';
|
||||
import * as ent from 'ent';
|
||||
import * as fs from 'fs';
|
||||
import * as readline from 'readline';
|
||||
|
||||
export function getOptionPrefix(signature: string) {
|
||||
if (signature.length > 1) {
|
||||
return '--';
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
|
||||
export function getOptionSignature(signature: string) {
|
||||
return `${getOptionPrefix(signature)}${signature}`;
|
||||
}
|
||||
|
||||
export function parseCapitanoOption(option: OptionDefinition): string {
|
||||
let result = getOptionSignature(option.signature);
|
||||
|
||||
if (Array.isArray(option.alias)) {
|
||||
for (const alias of option.alias) {
|
||||
result += `, ${getOptionSignature(alias)}`;
|
||||
}
|
||||
} else if (typeof option.alias === 'string') {
|
||||
result += `, ${getOptionSignature(option.alias)}`;
|
||||
}
|
||||
|
||||
if (option.parameter) {
|
||||
result += ` <${option.parameter}>`;
|
||||
}
|
||||
|
||||
return ent.encode(result);
|
||||
}
|
||||
|
||||
export class MarkdownFileParser {
|
||||
constructor(public mdFilePath: string) {}
|
||||
|
||||
|
6
npm-shrinkwrap.json
generated
6
npm-shrinkwrap.json
generated
@ -1331,9 +1331,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/traverse/node_modules/@babel/generator": {
|
||||
"version": "7.24.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.9.tgz",
|
||||
"integrity": "sha512-G8v3jRg+z8IwY1jHFxvCNhOPYPterE4XljNgdGTYfSTtzzwjIswIzIaSPSLs3R7yFuqnqNeay5rjICfqVr+/6A==",
|
||||
"version": "7.24.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.10.tgz",
|
||||
"integrity": "sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.24.9",
|
||||
|
99
typings/capitano/index.d.ts
vendored
99
typings/capitano/index.d.ts
vendored
@ -1,99 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Balena Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare module 'capitano' {
|
||||
export function parse(argv: string[]): Cli;
|
||||
|
||||
export interface Cli {
|
||||
command: string;
|
||||
options: object;
|
||||
global: {
|
||||
help?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface OptionDefinition {
|
||||
signature: string;
|
||||
description?: string;
|
||||
parameter?: string;
|
||||
// eslint-disable-next-line id-denylist
|
||||
boolean?: boolean;
|
||||
required?: string;
|
||||
alias?: string | string[];
|
||||
}
|
||||
|
||||
export interface CommandDefinition<P = object, O = object> {
|
||||
signature: string;
|
||||
description?: string;
|
||||
help?: string;
|
||||
options?: Partial<OptionDefinition[]>;
|
||||
permission?: string; // This should be 'user' but without full typescript we cannot enforce it
|
||||
root?: boolean;
|
||||
primary?: boolean;
|
||||
hidden?: boolean;
|
||||
action(params: P, options: Partial<O>, done: () => void): void;
|
||||
}
|
||||
|
||||
export interface Command {
|
||||
signature: Signature;
|
||||
options: Option[];
|
||||
isWildcard(): boolean;
|
||||
// You can pass whatever you want into a capitano command and it gets added as a prop
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface Signature {
|
||||
hasParameters(): boolean;
|
||||
hasVariadicParameters(): boolean;
|
||||
isWildcard(): boolean;
|
||||
allowsStdin(): boolean;
|
||||
}
|
||||
|
||||
export interface Option {
|
||||
signature: Signature;
|
||||
alias: string | string[];
|
||||
// eslint-disable-next-line id-denylist
|
||||
boolean: boolean;
|
||||
parameter: string;
|
||||
required: boolean | string;
|
||||
}
|
||||
|
||||
export function command<P, O>(command: CommandDefinition<P, O>): void;
|
||||
|
||||
export const state: {
|
||||
getMatchCommand: (
|
||||
signature: string,
|
||||
callback: (e: Error, cmd: Command) => void,
|
||||
) => void;
|
||||
commands: Command[];
|
||||
globalOptions: OptionDefinition[];
|
||||
};
|
||||
|
||||
export function run(
|
||||
command: string | string[],
|
||||
callback: (err: Error | null, result: any) => void,
|
||||
): void;
|
||||
export function execute(
|
||||
args: any,
|
||||
callback: (err?: Error, result: any) => void,
|
||||
): void;
|
||||
export function globalOption(option: OptionDefinition): void;
|
||||
export function permission(
|
||||
permissionName: string,
|
||||
callback: (done: () => void) => void,
|
||||
): void;
|
||||
}
|
21
typings/nplugm/index.d.ts
vendored
21
typings/nplugm/index.d.ts
vendored
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Balena Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare module 'nplugm' {
|
||||
import Bluebird = require('bluebird');
|
||||
export function list(regexp: RegExp): Bluebird<string[]>;
|
||||
}
|
23
typings/president/index.d.ts
vendored
23
typings/president/index.d.ts
vendored
@ -1,23 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Balena Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare module 'president' {
|
||||
export function execute(
|
||||
command: string[],
|
||||
callback: (err: Error) => void,
|
||||
): void;
|
||||
}
|
Loading…
Reference in New Issue
Block a user