# gonacli **Repository Path**: chenxxxxxxxx/gonacli ## Basic Information - **Project Name**: gonacli - **Description**: 一个用于管理 Nacos 配置中心、服务注册与命名空间的命令行工具 - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-22 - **Last Updated**: 2026-04-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # gonacli A command-line tool for managing Nacos configuration center, service registration, and namespaces. ## Features - **Configuration Management**: View, publish, delete, import, and export configurations - **Service Management**: View, create, and delete services - **Instance Management**: Register, deregister, and update service instances - **Namespace Management**: View, create, and delete namespaces ## Installation ### Build from Source ```bash # Clone the repository git clone cd gonacli # Build go build -o gonacli.exe main.go # Or use build scripts # Windows build.bat # Linux/Mac ./build.sh ``` ### Pre-built Binaries Download the executable for your platform from the [Releases](https://github.com/your-repo/gonacli/releases) page. ## Quick Start ### 1. Configuration File Create a `nacos.yaml` configuration file in the project root directory: ```yaml # Nacos server address server: http://127.0.0.1:8848 # Authentication credentials username: nacos password: nacos # Default namespace ID (optional, leave empty for public) namespace: "" ``` ### 2. Basic Usage ```bash # View help gonacli --help # View version gonacli version # List all configurations gonacli config list # List all namespaces gonacli ns list # List all services gonacli service list ``` ## Command Reference ### Global Flags ```bash gonacli --config ./nacos.yaml # Specify configuration file path gonacli --server http://localhost:8848 # Specify Nacos server address gonacli --username nacos # Specify username gonacli --password nacos # Specify password gonacli --namespace dev # Specify default namespace ID ``` ### Configuration Management ```bash # List configurations gonacli config list gonacli config list -n dev # Get configuration content gonacli config get -d application.yaml # Publish configuration gonacli config publish -d app.yaml -f ./app.yaml # Export configuration gonacli config export -d app.yaml -f ./backup.yaml # Delete configuration gonacli config delete -d app.yaml # View history versions gonacli config history -d app.yaml ``` ### Namespace Management ```bash # List namespaces gonacli ns list # Create namespace gonacli ns create --id dev --name "Development Environment" # Delete namespace gonacli ns delete --id dev ``` ### Service Management ```bash # List services gonacli service list gonacli service list -n dev # Get service details gonacli service get -s user-service # Create service gonacli service create -s my-service # Delete service gonacli service delete -s my-service ``` ### Instance Management ```bash # List instances gonacli instance list -s user-service # Register instance gonacli instance register -s my-service --ip 192.168.1.100 --port 8080 # Deregister instance gonacli instance deregister -s my-service --ip 192.168.1.100 --port 8080 # Update instance gonacli instance update -s my-service --ip 192.168.1.100 --port 8080 --weight 2.0 ``` For more command examples, please refer to [命令示例.md](命令示例.md). ## Tech Stack - **Go 1.26.0** - **Cobra** - CLI framework - **yaml.v3** - YAML configuration parsing ## Project Structure ``` gonacli/ ├── cmd/ # Command definitions │ ├── config.go # Configuration management commands │ ├── namespace.go # Namespace management commands │ └── service.go # Service and instance management commands ├── client/ # HTTP client │ ├── auth.go # Authentication related │ └── http.go # HTTP request wrapper ├── config/ # Configuration management │ └── config.go # Configuration file parsing ├── build/ # Build output directory ├── main.go # Program entry point ├── nacos.yaml # Configuration file example └── 命令示例.md # Detailed command examples ``` ## Development ```bash # Run go run main.go config list # Build go build -o gonacli.exe main.go # Cross-platform build # See build.bat or build.sh scripts ``` ## License MIT License