How to use @ionic/cli - 7 common examples

To help you get started, we’ve selected a few @ionic/cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionic-team / ionic-cli / packages / cli-plugin-cloud / src / commands / ssh / generate.ts View on Github external
if (!isSSHGenerateResponse(res)) {
      throw 'todo'; // TODO
    }

    tasks.next('writing ssh keys');

    await Promise.all([
      fsWriteFile(keyPath, res.data.key),
      fsWriteFile(pubkeyPath, res.data.pubkey)
    ]);

    tasks.end();

    this.env.log.info(`${ICON_SUCCESS_GREEN} A new pair of SSH keys has been downloaded to your computer!\n`
                    + `${indent()}Private Key (${chalk.bold(prettyPath(keyPath))}): Keep this in a safe spot (such as ${chalk.bold('~/.ssh/')}).\n`
                    + `${indent()}Public Key (${chalk.bold(prettyPath(pubkeyPath))}): Give this to all your friends!`);

  }
}
github ionic-team / ionic-cli / packages / cli-plugin-cloud / src / commands / ssh / generate.ts View on Github external
if (!isSSHGenerateResponse(res)) {
      throw 'todo'; // TODO
    }

    tasks.next('writing ssh keys');

    await Promise.all([
      fsWriteFile(keyPath, res.data.key),
      fsWriteFile(pubkeyPath, res.data.pubkey)
    ]);

    tasks.end();

    this.env.log.info(`${ICON_SUCCESS_GREEN} A new pair of SSH keys has been downloaded to your computer!\n`
                    + `${indent()}Private Key (${chalk.bold(prettyPath(keyPath))}): Keep this in a safe spot (such as ${chalk.bold('~/.ssh/')}).\n`
                    + `${indent()}Public Key (${chalk.bold(prettyPath(pubkeyPath))}): Give this to all your friends!`);

  }
}
github ionic-team / ionic-cli / packages / cli-plugin-cloud / src / commands / ssh / generate.ts View on Github external
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise {
    const keyPath = path.resolve(options['key-path'] ? String(options['key-path']) : 'id_rsa');
    const pubkeyPath = path.resolve(options['pubkey-path'] ? String(options['pubkey-path']) : 'id_rsa.pub');

    const tasks = new TaskChain();

    tasks.next('generating ssh keys');

    const req = this.env.client.make('POST', '/apps/sshkeys/generate').send({});
    const res = await this.env.client.do(req);

    if (!isSSHGenerateResponse(res)) {
      throw 'todo'; // TODO
    }

    tasks.next('writing ssh keys');

    await Promise.all([
      fsWriteFile(keyPath, res.data.key),
      fsWriteFile(pubkeyPath, res.data.pubkey)
    ]);
github ionic-team / ionic-cli / packages / cli-plugin-cloud / src / commands / ssh.ts View on Github external
import { Command, CommandLineInputs, CommandLineOptions, CommandMetadata, ICommand } from '@ionic/cli';

@CommandMetadata({
  name: 'ssh',
  description: 'Generate and manage SSH keys, configure local SSH authentication',
  isProjectTask: false
})
export default class SSHCommand extends Command implements ICommand {
  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise {
    console.log('hi');
  }
}
github ionic-team / ionic-cli / packages / cli-plugin-cloud / src / commands / ssh / generate.ts View on Github external
const fsWriteFile = promisify(fs.writeFile);

interface SSHGenerateResponse extends APIResponseSuccess {
  data: {
    key: string,
    pubkey: string
  }
}

function isSSHGenerateResponse(r: APIResponse): r is SSHGenerateResponse {
  return isAPIResponseSuccess(r)
    && typeof r.data['key'] === 'string'
    && typeof r.data['pubkey'] === 'string';
}

@CommandMetadata({
  name: 'generate',
  description: 'Generates a private and public SSH key pair',
  options: [
    {
      name: 'key-path',
      description: 'Destination of private key file',
      default: 'id_rsa'
    },
    {
      name: 'pubkey-path',
      description: 'Destination of public key file',
      default: 'id_rsa.pub'
    }
  ],
  isProjectTask: false
})
github ionic-team / ionic-cli / packages / cli-plugin-cloud / src / commands / ssh / generate.ts View on Github external
function isSSHGenerateResponse(r: APIResponse): r is SSHGenerateResponse {
  return isAPIResponseSuccess(r)
    && typeof r.data['key'] === 'string'
    && typeof r.data['pubkey'] === 'string';
}
github ionic-team / ionic-cli / packages / cli-plugin-cloud / src / commands / ssh / generate.ts View on Github external
APIResponseSuccess,
  Command,
  CommandLineInputs,
  CommandLineOptions,
  CommandMetadata,
  ICON_SUCCESS_GREEN,
  ICommand,
  ICommandMap,
  TaskChain,
  indent,
  isAPIResponseSuccess,
  prettyPath,
  promisify
} from '@ionic/cli';

const fsWriteFile = promisify(fs.writeFile);

interface SSHGenerateResponse extends APIResponseSuccess {
  data: {
    key: string,
    pubkey: string
  }
}

function isSSHGenerateResponse(r: APIResponse): r is SSHGenerateResponse {
  return isAPIResponseSuccess(r)
    && typeof r.data['key'] === 'string'
    && typeof r.data['pubkey'] === 'string';
}

@CommandMetadata({
  name: 'generate',

@ionic/cli

A tool for creating and developing Ionic Framework mobile apps.

MIT
Latest version published 11 months ago

Package Health Score

66 / 100
Full package analysis