Skip to content

Commit

Permalink
feat: rename executable file to staticfiles-sync
Browse files Browse the repository at this point in the history
This name better indicates what it does
  • Loading branch information
mvantellingen committed Feb 11, 2025
1 parent cd59ca9 commit aef51a9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
multicloud-cli
staticfiles-sync
dist/*
7 changes: 3 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -15,7 +15,6 @@ builds:
- darwin
goarch:
- amd64
- arm
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"

Expand All @@ -31,7 +30,7 @@ changelog:
- "^test:"

archives:
- id: "multicloud-cli"
- id: "staticfiles-sync"
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
format: zip
files:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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;
```
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 9 additions & 16 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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")
}

0 comments on commit aef51a9

Please sign in to comment.