Wangyq Wiki

安装与使用

如何安装、配置 Command+ API,并将其作为 CLI 或本地 API 使用。

Welcome to Command+ API (v1.0.1), a cross-platform CLI productivity tool designed for developers and power users. It extends your terminal with powerful utilities, acting as both a human-friendly CLI and a machine-friendly local API.

欢迎使用 Command+ API (v1.0.1),这是一款面向开发者和极客的跨平台命令行效率工具。它通过强大的实用程序扩展了您的终端,既是人类友好的 CLI,也是机器友好的本地 API。

Bienvenido a Command+ API (v1.0.1), una herramienta de productividad CLI multiplataforma. Extiende tu terminal con utilidades potentes, actuando tanto como CLI amigable y API local.

Добро пожаловать в Command+ API (v1.0.1), кроссплатформенный инструмент CLI. Он расширяет ваш терминал мощными утилитами, работая как удобный CLI и как локальный API.

1. Installation / 安装 / Instalación / Установка

Method 1: Pre-compiled Binary

Download the release package for your platform from Releases:

  • Windows: c-win-x64.zip
  • Linux: c-linux-x64.zip
  • macOS: c-macos-x64.zip

Extract the package, then add the folder to your system PATH (see "Add to System PATH" below).

Method 2: Compile from Source

Requirements: Node.js 16+ and npm

git clone https://github.com/GlassShadowX-studio/Command_plus_API.git
cd Command_plus_API
npm install
npm run build:win    # Windows
npm run build:mac    # macOS
npm run build:linux  # Linux

The executable is generated in the dist/ folder. Important: Copy the lib/ folder into dist/ — it must be distributed alongside the executable at runtime.

Add to System PATH

Windows (Run CMD as Administrator):

mkdir "C:\Program Files (x86)\command+ API"
copy c.exe "C:\Program Files (x86)\command+ API\"
xcopy lib "C:\Program Files (x86)\command+ API\lib\" /E
setx PATH "%PATH%;C:\Program Files (x86)\command+ API"

Restart your terminal for changes to take effect.

Linux / macOS:

mkdir -p ~/tools/cmd-plus
cp c ~/tools/cmd-plus/
cp -r lib ~/tools/cmd-plus/
echo 'export PATH="$PATH:~/tools/cmd-plus"' >> ~/.bashrc

Restart your terminal or run source ~/.bashrc.

Verify Installation

c --help

方法一:预编译二进制文件

Releases 下载对应平台的发布包:

  • Windows: c-win-x64.zip
  • Linux: c-linux-x64.zip
  • macOS: c-macos-x64.zip

解压后,将文件夹添加到系统 PATH(见下方"添加到系统 PATH")。

方法二:从源码编译

环境要求: Node.js 16+ 和 npm

git clone https://github.com/GlassShadowX-studio/Command_plus_API.git
cd Command_plus_API
npm install
npm run build:win    # Windows
npm run build:mac    # macOS
npm run build:linux  # Linux

可执行文件生成在 dist/ 文件夹中。重要: 编译后请将 lib/ 文件夹复制到 dist/ 中,lib/ 文件夹必须与可执行文件一起发布。

添加到系统 PATH

Windows(以管理员身份运行命令提示符):

mkdir "C:\Program Files (x86)\command+ API"
copy c.exe "C:\Program Files (x86)\command+ API\"
xcopy lib "C:\Program Files (x86)\command+ API\lib\" /E
setx PATH "%PATH%;C:\Program Files (x86)\command+ API"

重启终端以生效。

Linux / macOS:

mkdir -p ~/tools/cmd-plus
cp c ~/tools/cmd-plus/
cp -r lib ~/tools/cmd-plus/
echo 'export PATH="$PATH:~/tools/cmd-plus"' >> ~/.bashrc

重启终端或运行 source ~/.bashrc

验证安装

c --help

Método 1: Binario Precompilado

Descarga el paquete para tu plataforma desde Releases:

  • Windows: c-win-x64.zip
  • Linux: c-linux-x64.zip
  • macOS: c-macos-x64.zip

Extrae el paquete y añade la carpeta al PATH del sistema (ver "Añadir al PATH" abajo).

Método 2: Compilar desde Código Fuente

Requisitos: Node.js 16+ y npm

git clone https://github.com/GlassShadowX-studio/Command_plus_API.git
cd Command_plus_API
npm install
npm run build:win    # Windows
npm run build:mac    # macOS
npm run build:linux  # Linux

El ejecutable se genera en dist/. Importante: Copia la carpeta lib/ dentro de dist/ — debe distribuirse junto al ejecutable.

Añadir al PATH del Sistema

Windows (Ejecutar CMD como Administrador):

mkdir "C:\Program Files (x86)\command+ API"
copy c.exe "C:\Program Files (x86)\command+ API\"
xcopy lib "C:\Program Files (x86)\command+ API\lib\" /E
setx PATH "%PATH%;C:\Program Files (x86)\command+ API"

Reinicia la terminal para aplicar los cambios.

Linux / macOS:

mkdir -p ~/tools/cmd-plus
cp c ~/tools/cmd-plus/
cp -r lib ~/tools/cmd-plus/
echo 'export PATH="$PATH:~/tools/cmd-plus"' >> ~/.bashrc

Reinicia la terminal o ejecuta source ~/.bashrc.

Verificar Instalación

c --help

Способ 1: Готовый бинарный файл

Скачайте пакет для вашей платформы со страницы Releases:

  • Windows: c-win-x64.zip
  • Linux: c-linux-x64.zip
  • macOS: c-macos-x64.zip

Распакуйте и добавьте папку в системный PATH (см. "Добавить в PATH" ниже).

Способ 2: Сборка из исходного кода

Требования: Node.js 16+ и npm

git clone https://github.com/GlassShadowX-studio/Command_plus_API.git
cd Command_plus_API
npm install
npm run build:win    # Windows
npm run build:mac    # macOS
npm run build:linux  # Linux

Исполняемый файл создаётся в папке dist/. Важно: Скопируйте папку lib/ в dist/ — она должна распространяться вместе с исполняемым файлом.

Добавить в системный PATH

Windows (запустите CMD от имени администратора):

mkdir "C:\Program Files (x86)\command+ API"
copy c.exe "C:\Program Files (x86)\command+ API\"
xcopy lib "C:\Program Files (x86)\command+ API\lib\" /E
setx PATH "%PATH%;C:\Program Files (x86)\command+ API"

Перезапустите терминал для применения изменений.

Linux / macOS:

mkdir -p ~/tools/cmd-plus
cp c ~/tools/cmd-plus/
cp -r lib ~/tools/cmd-plus/
echo 'export PATH="$PATH:~/tools/cmd-plus"' >> ~/.bashrc

Перезапустите терминал или выполните source ~/.bashrc.

Проверка установки

c --help

2. Global Configuration / 全局配置 / Configuración Global / Глобальная конфигурация

Manage software settings like language preferences. Configs are saved in ~/.cmdplus/config.json.

管理语言偏好等软件设置。配置保存在 ~/.cmdplus/config.json 中。

Gestiona ajustes como el idioma. Guardado en ~/.cmdplus/config.json.

Управление настройками, такими как язык. Сохраняются в ~/.cmdplus/config.json.

# Switch to Chinese
c config language zh
# 切换为中文
c config language zh
# Cambiar a Chino
c config language zh
# Переключить на китайский
c config language zh

3. Package Management / 插件包管理 / Gestión de Paquetes / Управление пакетами

Features are loaded dynamically from the lib/ directory. You can enable or disable packages to keep your command list clean.

功能从 lib/ 目录动态加载。您可以启用或禁用包,以保持命令列表的整洁。

Las funciones se cargan dinámicamente desde lib/. Puedes habilitar o deshabilitar paquetes.

Функции загружаются из lib/. Вы можете включать или отключать пакеты.

c manage list      # List all packages
c manage disable web  # Disable web package
c manage list      # 列出所有包
c manage disable web  # 禁用 web 包
c manage list      # Listar paquetes
c manage disable web  # Deshabilitar web
c manage list      # Список пакетов
c manage disable web  # Отключить web

4. API Usage / 作为 API 使用 / Uso como API / Использование в качестве API

Output is strictly separated: data to stdout, errors to stderr. Perfect for Python, Shell, or Bat scripts.

输出严格分离:数据输出到 stdout,错误输出到 stderr。非常适合 Python、Shell 或 Bat 脚本。

Salida separada: datos a stdout, errores a stderr. Perfecto para scripts.

Вывод разделен: данные в stdout, ошибки в stderr. Идеально для скриптов.

import subprocess, json

res = subprocess.run(['c', 'ip', '-list'], capture_output=True, text=True)
ips = json.loads(res.stdout)
print(ips)

On this page