HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/self/root/usr/local/lib/node_modules/@ionic/cli/commands/completion.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompletionCommand = void 0;
const tslib_1 = require("tslib");
const cli_framework_1 = require("@ionic/cli-framework");
const utils_terminal_1 = require("@ionic/utils-terminal");
const path = tslib_1.__importStar(require("path"));
const color_1 = require("../lib/color");
const command_1 = require("../lib/command");
const errors_1 = require("../lib/errors");
class CompletionCommand extends command_1.Command {
    async getMetadata() {
        return {
            name: 'completion',
            type: 'global',
            summary: 'Enables tab-completion for Ionic CLI commands.',
            description: `
This command is experimental and only works for Z shell (zsh) and non-Windows platforms.

To enable completions for the Ionic CLI, you can add the completion code that this command prints to your ${(0, color_1.strong)('~/.zshrc')} (or any other file loaded with your shell). See the examples.
      `,
            groups: ["experimental" /* MetadataGroup.EXPERIMENTAL */],
            exampleCommands: [
                '',
                '>> ~/.zshrc',
            ],
        };
    }
    async run(inputs, options) {
        if (utils_terminal_1.TERMINAL_INFO.windows) {
            throw new errors_1.FatalException('Completion is not supported on Windows shells.');
        }
        if (path.basename(utils_terminal_1.TERMINAL_INFO.shell) !== 'zsh') {
            throw new errors_1.FatalException('Completion is currently only available for Z Shell (zsh).');
        }
        const words = options['--'];
        if (!words || words.length === 0) {
            const namespace = this.namespace.root;
            const formatter = new cli_framework_1.ZshCompletionFormatter({ namespace });
            process.stdout.write(await formatter.format());
            return;
        }
        const ns = this.namespace.root;
        const outputWords = await (0, cli_framework_1.getCompletionWords)(ns, words.slice(1));
        process.stdout.write(outputWords.join(' '));
    }
}
exports.CompletionCommand = CompletionCommand;