diff --git a/.gitignore b/.gitignore index 6ed0082..b932018 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -multicloud-cli +staticfiles-sync dist/* diff --git a/.goreleaser.yml b/.goreleaser.yml index 3aa5463..872b219 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,7 +1,7 @@ -project_name: multicloud-cli +project_name: "staticfiles-sync" builds: - - id: "multicloud-cli" + - id: "staticfiles-sync" main: ./main.go binary: "{{ .ProjectName }}_v{{ .Version }}" flags: @@ -15,7 +15,6 @@ builds: - darwin goarch: - amd64 - - arm - arm64 mod_timestamp: "{{ .CommitTimestamp }}" @@ -31,7 +30,7 @@ changelog: - "^test:" archives: - - id: "multicloud-cli" + - id: "staticfiles-sync" name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" format: zip files: diff --git a/README.md b/README.md index d45f9ef..91c2d2b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # cloudstaticfiles -Simple CLI command to sync a directory to a cloud bucket (aws, gcp, azure). It uses a lockfile to indicate if a directory has been copied already. -This command is especially helpful when run on docker startup to copy for example static files to a target store +Simple CLI command to sync a directory to a cloud bucket (aws, gcp, azure). It +uses a lockfile to indicate if a directory has been copied already. This +command is especially helpful when run on docker startup to copy for example +static files to a target store ```bash -multicloud-cli sync -s .next/static -t gcp://my-static-files-bucket/_next/static -l .locks/v1.0.0; +staticfiles-sync -s .next/static -t gcp://my-static-files-bucket/_next/static -l .locks/v1.0.0; ``` diff --git a/Taskfile.yaml b/Taskfile.yaml index fe527e3..78373b4 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -4,7 +4,7 @@ tasks: build: env: GORELEASER_CURRENT_TAG: "v0.0.0" - cmd: goreleaser build --snapshot --clean --single-target --output multicloud-cli + cmd: goreleaser build --snapshot --clean --single-target --output staticfiles-sync download: cmd: go mod download diff --git a/cmd/main.go b/cmd/main.go index 6a39d23..7520d48 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -27,12 +27,7 @@ func NewStorageClient(ctx context.Context, provider, bucket string) (internal.St } var RootCmd = &cobra.Command{ - Use: "multicloud-cli", - Short: "A CLI tool for multi-cloud file operations", -} - -var syncCmd = &cobra.Command{ - Use: "sync", + Use: "staticfiles-sync", Short: "Sync a local directory with a specified cloud provider's remote directory", Run: func(cmd *cobra.Command, args []string) { ctx := cmd.Context() @@ -93,14 +88,12 @@ var syncCmd = &cobra.Command{ } func init() { - syncCmd.Flags().StringP("source", "s", "", "Path to the local directory") - syncCmd.Flags().StringP("target", "t", "", "Remote URL in the format scheme://bucket/path") - syncCmd.Flags().StringP("lockfile", "l", "", "Remote file path that must not exist before sync") - syncCmd.Flags().String("cache-control", "", "Cache Control header value for uploaded files") - - syncCmd.MarkFlagRequired("lockfile") - syncCmd.MarkFlagRequired("source") - syncCmd.MarkFlagRequired("target") - - RootCmd.AddCommand(syncCmd) + RootCmd.Flags().StringP("source", "s", "", "Path to the local directory") + RootCmd.Flags().StringP("target", "t", "", "Remote URL in the format scheme://bucket/path") + RootCmd.Flags().StringP("lockfile", "l", "", "Remote file path that must not exist before sync") + RootCmd.Flags().String("cache-control", "", "Cache Control header value for uploaded files") + + RootCmd.MarkFlagRequired("lockfile") + RootCmd.MarkFlagRequired("source") + RootCmd.MarkFlagRequired("target") }