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}}"
|
version_template: "{{ incminor .Version }}-nightly-{{.ShortCommit}}"
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
- id: uncloud
|
- id: uc
|
||||||
main: ./cmd/uncloud
|
main: ./cmd/uc
|
||||||
binary: uncloud
|
binary: uc
|
||||||
env:
|
env:
|
||||||
# Use CGO to be able to build fsevent required by compose on macOS.
|
# Use CGO to be able to build fsevent required by compose on macOS.
|
||||||
- CGO_ENABLED={{ if eq .Os "darwin" }}1{{ else }}0{{ end }}
|
- CGO_ENABLED={{ if eq .Os "darwin" }}1{{ else }}0{{ end }}
|
||||||
@@ -60,9 +60,9 @@ builds:
|
|||||||
-X github.com/psviderski/uncloud/internal/version.builtBy=goreleaser
|
-X github.com/psviderski/uncloud/internal/version.builtBy=goreleaser
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- id: uncloud
|
- id: uc
|
||||||
builds:
|
builds:
|
||||||
- uncloud
|
- uc
|
||||||
formats:
|
formats:
|
||||||
# gz is not compatible with homebrew releases, so we use tar.gz
|
# gz is not compatible with homebrew releases, so we use tar.gz
|
||||||
- tar.gz
|
- tar.gz
|
||||||
@@ -103,10 +103,9 @@ brews:
|
|||||||
description: "Uncloud CLI"
|
description: "Uncloud CLI"
|
||||||
homepage: "https://uncloud.run"
|
homepage: "https://uncloud.run"
|
||||||
ids:
|
ids:
|
||||||
- uncloud
|
- uc
|
||||||
install: |
|
install: |
|
||||||
bin.install "uncloud"
|
bin.install "uc"
|
||||||
bin.install_symlink "uncloud" => "uc"
|
|
||||||
skip_upload: false
|
skip_upload: false
|
||||||
repository:
|
repository:
|
||||||
owner: psviderski
|
owner: psviderski
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ management.
|
|||||||
|
|
||||||
- **`cmd/`**: Contains main applications
|
- **`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
|
- `uncloudd/`: Daemon that runs on each machine
|
||||||
- `ucind/`: Development cluster management for testing
|
- `ucind/`: Development cluster management for testing
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ github.com/siderolabs/grpc-proxy // gRPC proxy for forwarding
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build binaries
|
# Build binaries
|
||||||
go build -o uncloud ./cmd/uncloud
|
go build -o uc ./cmd/uc
|
||||||
go build -o uncloudd ./cmd/uncloudd
|
go build -o uncloudd ./cmd/uncloudd
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ uc context use <name> # Switch context
|
|||||||
|
|
||||||
### Important Files to Understand
|
### 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/cli/cli.go`: CLI implementation and configuration
|
||||||
- `internal/machine/machine.go`: Core machine management
|
- `internal/machine/machine.go`: Core machine management
|
||||||
- `pkg/api/`: Public API definitions
|
- `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:
|
Build the CLI:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
go build -o uc ./cmd/uncloud
|
go build -o uc ./cmd/uc
|
||||||
```
|
```
|
||||||
|
|
||||||
Or build and run the CLI with a single command:
|
Or build and run the CLI with a single command:
|
||||||
|
|
||||||
```shell
|
```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
|
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
|
.PHONY: cli-docs
|
||||||
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
|
package caddy
|
||||||
|
|
||||||
import (
|
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"
|
||||||
"github.com/psviderski/uncloud/internal/cli/logs"
|
"github.com/psviderski/uncloud/internal/cli/logs"
|
||||||
"github.com/spf13/cobra"
|
"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"
|
"errors"
|
||||||
"fmt"
|
"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/cli"
|
||||||
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
||||||
"github.com/psviderski/uncloud/pkg/api"
|
"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 (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/psviderski/uncloud/cmd/uncloud/image"
|
"github.com/psviderski/uncloud/cmd/uc/image"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
"charm.land/lipgloss/v2"
|
"charm.land/lipgloss/v2"
|
||||||
"github.com/docker/compose/v2/pkg/progress"
|
"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"
|
||||||
"github.com/psviderski/uncloud/internal/cli/config"
|
"github.com/psviderski/uncloud/internal/cli/config"
|
||||||
"github.com/psviderski/uncloud/internal/cli/tui"
|
"github.com/psviderski/uncloud/internal/cli/tui"
|
||||||
File renamed without changes.
@@ -8,8 +8,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/compose/v2/pkg/progress"
|
"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/cmd/uncloud/dns"
|
"github.com/psviderski/uncloud/cmd/uc/dns"
|
||||||
"github.com/psviderski/uncloud/internal/cli"
|
"github.com/psviderski/uncloud/internal/cli"
|
||||||
"github.com/psviderski/uncloud/internal/cli/config"
|
"github.com/psviderski/uncloud/internal/cli/config"
|
||||||
"github.com/psviderski/uncloud/internal/cli/tui"
|
"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"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/psviderski/uncloud/cmd/uncloud/caddy"
|
"github.com/psviderski/uncloud/cmd/uc/caddy"
|
||||||
cmdcontext "github.com/psviderski/uncloud/cmd/uncloud/context"
|
cmdcontext "github.com/psviderski/uncloud/cmd/uc/context"
|
||||||
"github.com/psviderski/uncloud/cmd/uncloud/dns"
|
"github.com/psviderski/uncloud/cmd/uc/dns"
|
||||||
"github.com/psviderski/uncloud/cmd/uncloud/image"
|
"github.com/psviderski/uncloud/cmd/uc/image"
|
||||||
cmdmachine "github.com/psviderski/uncloud/cmd/uncloud/machine"
|
cmdmachine "github.com/psviderski/uncloud/cmd/uc/machine"
|
||||||
"github.com/psviderski/uncloud/cmd/uncloud/service"
|
"github.com/psviderski/uncloud/cmd/uc/service"
|
||||||
"github.com/psviderski/uncloud/cmd/uncloud/volume"
|
"github.com/psviderski/uncloud/cmd/uc/volume"
|
||||||
"github.com/psviderski/uncloud/cmd/uncloud/wg"
|
"github.com/psviderski/uncloud/cmd/uc/wg"
|
||||||
"github.com/psviderski/uncloud/internal/cli"
|
"github.com/psviderski/uncloud/internal/cli"
|
||||||
"github.com/psviderski/uncloud/internal/cli/config"
|
"github.com/psviderski/uncloud/internal/cli/config"
|
||||||
"github.com/psviderski/uncloud/internal/cli/tui"
|
"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]
|
[tasks.uc]
|
||||||
description = "Run the Uncloud CLI"
|
description = "Run the Uncloud CLI"
|
||||||
run = "go run ./cmd/uncloud"
|
run = "go run ./cmd/uc"
|
||||||
|
|
||||||
[tasks.ucind]
|
[tasks.ucind]
|
||||||
description = "Run ucind CLI for managing local Docker-based clusters"
|
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}"
|
RELEASES_URL="https://github.com/${GITHUB_REPO}/releases/${VERSION}"
|
||||||
echo "Failed while attempting to install uncloud CLI. You can install it manually:"
|
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 " 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 " 2. Download uc_<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 " 3. Extract the 'uc' binary from the archive: tar -xvf uc_*.tar.gz"
|
||||||
echo " 4. Install the binary to /usr/local/bin: sudo install ./uncloud ${INSTALL_DIR}/uncloud"
|
echo " 4. Install the binary to /usr/local/bin: sudo install ./uc ${INSTALL_DIR}/uc"
|
||||||
echo " 5. Optionally create a 'uc' symlink: sudo ln -sf ${INSTALL_DIR}/uncloud ${INSTALL_DIR}/uc"
|
echo " 5. Delete the downloaded archive and extracted binary: rm uc*"
|
||||||
echo " 6. Delete the downloaded archive and extracted binary: rm uncloud*"
|
echo " 6. Run 'uc --help' to verify the installation. Enjoy! ✨"
|
||||||
echo " 7. Run 'uncloud --help' to verify the installation. Enjoy! ✨"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_latest_version() {
|
fetch_latest_version() {
|
||||||
@@ -64,7 +63,7 @@ esac
|
|||||||
if [ "$VERSION" = "latest" ]; then
|
if [ "$VERSION" = "latest" ]; then
|
||||||
fetch_latest_version
|
fetch_latest_version
|
||||||
fi
|
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}"
|
BINARY_URL="https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/${BINARY_NAME}"
|
||||||
CHECKSUM_URL="https://github.com/${GITHUB_REPO}/releases/download/$VERSION/checksums.txt"
|
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
|
trap 'rm -rf "$TMP_DIR"' EXIT
|
||||||
|
|
||||||
# Download the binary and checksums file.
|
# 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 "$BINARY_URL" -o "${TMP_DIR}/${BINARY_NAME}"
|
||||||
curl -fsSL "$CHECKSUM_URL" -o "${TMP_DIR}/checksums.txt"
|
curl -fsSL "$CHECKSUM_URL" -o "${TMP_DIR}/checksums.txt"
|
||||||
echo "Download complete."
|
echo "Download complete."
|
||||||
@@ -91,17 +90,14 @@ echo "Checksum is valid."
|
|||||||
tar -xf "${BINARY_NAME}"
|
tar -xf "${BINARY_NAME}"
|
||||||
|
|
||||||
if [ -z "${SUDO}" ]; then
|
if [ -z "${SUDO}" ]; then
|
||||||
echo "Installing uncloud binary to ${INSTALL_DIR}"
|
echo "Installing uc binary to ${INSTALL_DIR}"
|
||||||
else
|
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
|
fi
|
||||||
if ! $SUDO install ./uncloud "${INSTALL_DIR}/uncloud"; then
|
if ! $SUDO install ./uc "${INSTALL_DIR}/uc"; then
|
||||||
echo "Failed to install uncloud binary to ${INSTALL_DIR}"
|
echo "Failed to install uc binary to ${INSTALL_DIR}"
|
||||||
print_manual_install
|
print_manual_install
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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 "Successfully installed uc binary ${VERSION} to ${INSTALL_DIR}/uc ✨"
|
||||||
echo "Created a shortcut command 'uc' for convenience ✨"
|
|
||||||
@@ -36,8 +36,7 @@ The script will:
|
|||||||
|
|
||||||
- Detect your operating system and architecture
|
- Detect your operating system and architecture
|
||||||
- Download the appropriate latest binary from [GitHub releases](https://github.com/psviderski/uncloud/releases)
|
- 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)
|
- Install it to `/usr/local/bin/uc` using `sudo` (you may need to enter your user password)
|
||||||
- Create a shortcut `uc` in `/usr/local/bin` for convenience
|
|
||||||
|
|
||||||
Don't like `curl | sh`? You can download and review the [install script](https://get.uncloud.run/install.sh) first and
|
Don't like `curl | sh`? You can download and review the [install script](https://get.uncloud.run/install.sh) first and
|
||||||
then run it:
|
then run it:
|
||||||
@@ -66,26 +65,22 @@ You can manually download and use a pre-built binary from the
|
|||||||
<Tabs>
|
<Tabs>
|
||||||
<TabItem value="macOS (Apple Silicon)">
|
<TabItem value="macOS (Apple Silicon)">
|
||||||
```shell
|
```shell
|
||||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uncloud_macos_arm64.tar.gz | tar xz
|
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uc_macos_arm64.tar.gz | tar xz
|
||||||
mv uncloud uc
|
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="macOS (Intel)">
|
<TabItem value="macOS (Intel)">
|
||||||
```shell
|
```shell
|
||||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uncloud_macos_amd64.tar.gz | tar xz
|
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uc_macos_amd64.tar.gz | tar xz
|
||||||
mv uncloud uc
|
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="Linux (AMD 64-bit)">
|
<TabItem value="Linux (AMD 64-bit)">
|
||||||
```shell
|
```shell
|
||||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uncloud_linux_amd64.tar.gz | tar xz
|
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uc_linux_amd64.tar.gz | tar xz
|
||||||
mv uncloud uc
|
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="Linux (ARM 64-bit)">
|
<TabItem value="Linux (ARM 64-bit)">
|
||||||
```shell
|
```shell
|
||||||
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uncloud_linux_arm64.tar.gz | tar xz
|
curl -L https://github.com/psviderski/uncloud/releases/latest/download/uc_linux_arm64.tar.gz | tar xz
|
||||||
mv uncloud uc
|
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
Reference in new issue
Block a user