mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-24 15:56:38 +00:00
5cbe1c410f
Both commands work with local devices by remotely invoking the `os-config` executable via SSH. This requires an as of yet unreleased resinOS (that will most likely be v2.14) and the commands ascertain compatibility merely by looking for the `os-config` executable in the device, and bail out if it’s not present. `join` and `leave` accept a couple of optional arguments and implement a wizard-style interface if these are not given. They allow to interactively select the device and the application to promote to. If the user has no apps, `join` will offer the user to create one. `join` will also offer the user to login or create an account if they’re not logged in already without exiting the wizard. `resin-sync` (that's used internally to discover local devices) requires admin privileges. If no device has been specified as an argument, the commands will launch the device scanning process in a privileged subprocess via two new internal commands: `internal sudo` and `internal scanDevices`. This avoids having the user to invoke the commands with sudo and only request escalation if truly needed. This commit also removes the dependency to “president”, implementing “sudo” functionality within the CLI. Change-Type: minor
59 lines
1.1 KiB
TypeScript
59 lines
1.1 KiB
TypeScript
declare module 'capitano' {
|
|
export function parse(argv: string[]): Cli;
|
|
|
|
export interface Cli {
|
|
command: string;
|
|
options: {};
|
|
global: {};
|
|
}
|
|
|
|
export interface OptionDefinition {
|
|
signature: string;
|
|
description: string;
|
|
parameter?: string;
|
|
boolean?: boolean;
|
|
alias?: string | string[];
|
|
}
|
|
|
|
export interface CommandDefinition<P = {}, O = {}> {
|
|
signature: string;
|
|
description: string;
|
|
help: string;
|
|
options?: OptionDefinition[];
|
|
permission?: 'user';
|
|
root?: boolean;
|
|
primary?: boolean;
|
|
action(params: P, options: O, done: () => void): void;
|
|
}
|
|
|
|
export interface Command {
|
|
signature: Signature;
|
|
options: Option[];
|
|
isWildcard(): boolean;
|
|
}
|
|
|
|
export interface Signature {
|
|
hasParameters(): boolean;
|
|
hasVariadicParameters(): boolean;
|
|
isWildcard(): boolean;
|
|
allowsStdin(): boolean;
|
|
}
|
|
|
|
export interface Option {
|
|
signature: Signature;
|
|
alias: string | string[];
|
|
boolean: boolean;
|
|
parameter: string;
|
|
required: boolean | string;
|
|
}
|
|
|
|
export function command(command: CommandDefinition): void;
|
|
|
|
export const state: {
|
|
getMatchCommand: (
|
|
signature: string,
|
|
callback: (e: Error, cmd: Command) => void,
|
|
) => void;
|
|
};
|
|
}
|