mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-06 13:18:58 +00:00
refactor(cli): move cmd/uncloud to cmd/uc, change the artifact name uncloud_* -> uc_*
This commit is contained in:
1 parent
e01c8d3cc7
commit
a5d73fe4d7
61 files changed
+45
-55
No files matched your search
+7
-8
@@ -20,9 +20,9 @@ snapshot:
|
||||
version_template: "{{ incminor .Version }}-nightly-{{.ShortCommit}}"
|
||||
|
||||
builds:
|
||||
- id: uncloud
|
||||
main: ./cmd/uncloud
|
||||
binary: uncloud
|
||||
- id: uc
|
||||
main: ./cmd/uc
|
||||
binary: uc
|
||||
env:
|
||||
# Use CGO to be able to build fsevent required by compose on macOS.
|
||||
- CGO_ENABLED={{ if eq .Os "darwin" }}1{{ else }}0{{ end }}
|
||||
@@ -60,9 +60,9 @@ builds:
|
||||
-X github.com/psviderski/uncloud/internal/version.builtBy=goreleaser
|
||||
|
||||
archives:
|
||||
- id: uncloud
|
||||
- id: uc
|
||||
builds:
|
||||
- uncloud
|
||||
- uc
|
||||
formats:
|
||||
# gz is not compatible with homebrew releases, so we use tar.gz
|
||||
- tar.gz
|
||||
@@ -103,10 +103,9 @@ brews:
|
||||
description: "Uncloud CLI"
|
||||
homepage: "https://uncloud.run"
|
||||
ids:
|
||||
- uncloud
|
||||
- uc
|
||||
install: |
|
||||
bin.install "uncloud"
|
||||
bin.install_symlink "uncloud" => "uc"
|
||||
bin.install "uc"
|
||||
skip_upload: false
|
||||
repository:
|
||||
owner: psviderski
|
||||
|
||||
@@ -72,7 +72,7 @@ management.
|
||||
|
||||
- **`cmd/`**: Contains main applications
|
||||
|
||||
- `uncloud/`: CLI tool with subcommands for machine, service, volume management
|
||||
- `uc/`: CLI tool with subcommands for machine, service, volume management
|
||||
- `uncloudd/`: Daemon that runs on each machine
|
||||
- `ucind/`: Development cluster management for testing
|
||||
|
||||
@@ -131,7 +131,7 @@ github.com/siderolabs/grpc-proxy // gRPC proxy for forwarding
|
||||
|
||||
```bash
|
||||
# Build binaries
|
||||
go build -o uncloud ./cmd/uncloud
|
||||
go build -o uc ./cmd/uc
|
||||
go build -o uncloudd ./cmd/uncloudd
|
||||
```
|
||||
|
||||
@@ -239,7 +239,7 @@ uc context use <name> # Switch context
|
||||
|
||||
### Important Files to Understand
|
||||
|
||||
- `cmd/uncloud/main.go`: CLI entry point and command structure
|
||||
- `cmd/uc/main.go`: CLI entry point and command structure
|
||||
- `internal/cli/cli.go`: CLI implementation and configuration
|
||||
- `internal/machine/machine.go`: Core machine management
|
||||
- `pkg/api/`: Public API definitions
|
||||
|
||||
+2
-2
@@ -32,13 +32,13 @@ available outside the project, so they don't interfere with system packages.
|
||||
Build the CLI:
|
||||
|
||||
```shell
|
||||
go build -o uc ./cmd/uncloud
|
||||
go build -o uc ./cmd/uc
|
||||
```
|
||||
|
||||
Or build and run the CLI with a single command:
|
||||
|
||||
```shell
|
||||
go run ./cmd/uncloud --help
|
||||
go run ./cmd/uc --help
|
||||
```
|
||||
|
||||
The Uncloud daemon (`uncloudd`) only supports Linux, so you need to cross-compile it if you're developing on macOS or
|
||||
|
||||
@@ -72,4 +72,4 @@ _lint:
|
||||
|
||||
.PHONY: cli-docs
|
||||
cli-docs:
|
||||
go run ./cmd/uncloud docs
|
||||
go run ./cmd/uc docs
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
package caddy
|
||||
|
||||
import (
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/service"
|
||||
"github.com/psviderski/uncloud/cmd/uc/service"
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/psviderski/uncloud/internal/cli/logs"
|
||||
"github.com/spf13/cobra"
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/caddy"
|
||||
"github.com/psviderski/uncloud/cmd/uc/caddy"
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
||||
"github.com/psviderski/uncloud/pkg/api"
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/image"
|
||||
"github.com/psviderski/uncloud/cmd/uc/image"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"charm.land/lipgloss/v2"
|
||||
"github.com/docker/compose/v2/pkg/progress"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/caddy"
|
||||
"github.com/psviderski/uncloud/cmd/uc/caddy"
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/psviderski/uncloud/internal/cli/config"
|
||||
"github.com/psviderski/uncloud/internal/cli/tui"
|
||||
File renamed without changes.
@@ -8,8 +8,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/compose/v2/pkg/progress"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/caddy"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/dns"
|
||||
"github.com/psviderski/uncloud/cmd/uc/caddy"
|
||||
"github.com/psviderski/uncloud/cmd/uc/dns"
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/psviderski/uncloud/internal/cli/config"
|
||||
"github.com/psviderski/uncloud/internal/cli/tui"
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -8,14 +8,14 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/caddy"
|
||||
cmdcontext "github.com/psviderski/uncloud/cmd/uncloud/context"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/dns"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/image"
|
||||
cmdmachine "github.com/psviderski/uncloud/cmd/uncloud/machine"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/service"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/volume"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/wg"
|
||||
"github.com/psviderski/uncloud/cmd/uc/caddy"
|
||||
cmdcontext "github.com/psviderski/uncloud/cmd/uc/context"
|
||||
"github.com/psviderski/uncloud/cmd/uc/dns"
|
||||
"github.com/psviderski/uncloud/cmd/uc/image"
|
||||
cmdmachine "github.com/psviderski/uncloud/cmd/uc/machine"
|
||||
"github.com/psviderski/uncloud/cmd/uc/service"
|
||||
"github.com/psviderski/uncloud/cmd/uc/volume"
|
||||
"github.com/psviderski/uncloud/cmd/uc/wg"
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/psviderski/uncloud/internal/cli/config"
|
||||
"github.com/psviderski/uncloud/internal/cli/tui"
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -49,7 +49,7 @@ protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=p
|
||||
|
||||
[tasks.uc]
|
||||
description = "Run the Uncloud CLI"
|
||||
run = "go run ./cmd/uncloud"
|
||||
run = "go run ./cmd/uc"
|
||||
|
||||
[tasks.ucind]
|
||||
description = "Run ucind CLI for managing local Docker-based clusters"
|
||||
|
||||
+12
-16
@@ -11,12 +11,11 @@ print_manual_install() {
|
||||
RELEASES_URL="https://github.com/${GITHUB_REPO}/releases/${VERSION}"
|
||||
echo "Failed while attempting to install uncloud CLI. You can install it manually:"
|
||||
echo " 1. Open your web browser and go to ${RELEASES_URL}"
|
||||
echo " 2. Download uncloud_<OS>_<ARCH>.tar.gz for your platform (OS: linux/macos, ARCH: amd64/arm64)."
|
||||
echo " 3. Extract the 'uncloud' binary from the archive: tar -xvf uncloud_*.tar.gz"
|
||||
echo " 4. Install the binary to /usr/local/bin: sudo install ./uncloud ${INSTALL_DIR}/uncloud"
|
||||
echo " 5. Optionally create a 'uc' symlink: sudo ln -sf ${INSTALL_DIR}/uncloud ${INSTALL_DIR}/uc"
|
||||
echo " 6. Delete the downloaded archive and extracted binary: rm uncloud*"
|
||||
echo " 7. Run 'uncloud --help' to verify the installation. Enjoy! ✨"
|
||||
echo " 2. Download uc_<OS>_<ARCH>.tar.gz for your platform (OS: linux/macos, ARCH: amd64/arm64)."
|
||||
echo " 3. Extract the 'uc' binary from the archive: tar -xvf uc_*.tar.gz"
|
||||
echo " 4. Install the binary to /usr/local/bin: sudo install ./uc ${INSTALL_DIR}/uc"
|
||||
echo " 5. Delete the downloaded archive and extracted binary: rm uc*"
|
||||
echo " 6. Run 'uc --help' to verify the installation. Enjoy! ✨"
|
||||
}
|
||||
|
||||
fetch_latest_version() {
|
||||
@@ -64,7 +63,7 @@ esac
|
||||
if [ "$VERSION" = "latest" ]; then
|
||||
fetch_latest_version
|
||||
fi
|
||||
BINARY_NAME="uncloud_${BINARY_OS}_${BINARY_ARCH}.tar.gz"
|
||||
BINARY_NAME="uc_${BINARY_OS}_${BINARY_ARCH}.tar.gz"
|
||||
BINARY_URL="https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/${BINARY_NAME}"
|
||||
CHECKSUM_URL="https://github.com/${GITHUB_REPO}/releases/download/$VERSION/checksums.txt"
|
||||
|
||||
@@ -73,7 +72,7 @@ TMP_DIR=$(mktemp -d)
|
||||
trap 'rm -rf "$TMP_DIR"' EXIT
|
||||
|
||||
# Download the binary and checksums file.
|
||||
echo "Downloading uncloud binary ${VERSION} ${BINARY_URL}"
|
||||
echo "Downloading uc binary ${VERSION} ${BINARY_URL}"
|
||||
curl -fsSL "$BINARY_URL" -o "${TMP_DIR}/${BINARY_NAME}"
|
||||
curl -fsSL "$CHECKSUM_URL" -o "${TMP_DIR}/checksums.txt"
|
||||
echo "Download complete."
|
||||
@@ -91,17 +90,14 @@ echo "Checksum is valid."
|
||||
tar -xf "${BINARY_NAME}"
|
||||
|
||||
if [ -z "${SUDO}" ]; then
|
||||
echo "Installing uncloud binary to ${INSTALL_DIR}"
|
||||
echo "Installing uc binary to ${INSTALL_DIR}"
|
||||
else
|
||||
echo "Installing uncloud binary to ${INSTALL_DIR} using sudo. You may be prompted for your password."
|
||||
echo "Installing uc binary to ${INSTALL_DIR} using sudo. You may be prompted for your password."
|
||||
fi
|
||||
if ! $SUDO install ./uncloud "${INSTALL_DIR}/uncloud"; then
|
||||
echo "Failed to install uncloud binary to ${INSTALL_DIR}"
|
||||
if ! $SUDO install ./uc "${INSTALL_DIR}/uc"; then
|
||||
echo "Failed to install uc binary to ${INSTALL_DIR}"
|
||||
print_manual_install
|
||||
exit 1
|
||||
fi
|
||||
# Create 'uc' shortcut symlink.
|
||||
$SUDO ln -sf "${INSTALL_DIR}/uncloud" "${INSTALL_DIR}/uc"
|
||||
|
||||
echo "Successfully installed uncloud binary ${VERSION} to ${INSTALL_DIR}/uncloud"
|
||||
echo "Created a shortcut command 'uc' for convenience ✨"
|
||||
echo "Successfully installed uc binary ${VERSION} to ${INSTALL_DIR}/uc ✨"
|
||||
@@ -36,8 +36,7 @@ The script will:
|
||||
|
||||
- Detect your operating system and architecture
|
||||
- Download the appropriate latest binary from [GitHub releases](https://github.com/psviderski/uncloud/releases)
|
||||
- Install it to `/usr/local/bin/uncloud` using `sudo` (you may need to enter your user password)
|
||||
- Create a shortcut `uc` in `/usr/local/bin` for convenience
|
||||
- Install it to `/usr/local/bin/uc` using `sudo` (you may need to enter your user password)
|
||||
|
||||
Don't like `curl | sh`? You can download and review the [install script](https://get.uncloud.run/install.sh) first and
|
||||
then run it:
|
||||
@@ -66,26 +65,22 @@ You can manually download and use a pre-built binary from the
|
||||
<Tabs>
|
||||
<TabItem value="macOS (Apple Silicon)">
|
||||
```shell
|
||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uncloud_macos_arm64.tar.gz | tar xz
|
||||
mv uncloud uc
|
||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uc_macos_arm64.tar.gz | tar xz
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="macOS (Intel)">
|
||||
```shell
|
||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uncloud_macos_amd64.tar.gz | tar xz
|
||||
mv uncloud uc
|
||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uc_macos_amd64.tar.gz | tar xz
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="Linux (AMD 64-bit)">
|
||||
```shell
|
||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uncloud_linux_amd64.tar.gz | tar xz
|
||||
mv uncloud uc
|
||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uc_linux_amd64.tar.gz | tar xz
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="Linux (ARM 64-bit)">
|
||||
```shell
|
||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uncloud_linux_arm64.tar.gz | tar xz
|
||||
mv uncloud uc
|
||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uc_linux_arm64.tar.gz | tar xz
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
Reference in new issue
Block a user