Skip to content

Commit

Permalink
better print format
Browse files Browse the repository at this point in the history
  • Loading branch information
YieldRay committed Feb 12, 2024
1 parent 66e1a65 commit a75fb3d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Features:
- Multi-user support
- Friendly for CI environments

For github actions, see [deploy-to-surge-action](https://github.com/YieldRay/deploy-to-surge-action)

## usage

Manage your site
Expand Down
1 change: 1 addition & 0 deletions cli/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var httpClient = &http.Client{Transport: utils.RoundTrip(func(req *http.Request)
} else {
log.Println(string(b))
}
fmt.Println()
}

// send the actual request
Expand Down
6 changes: 4 additions & 2 deletions cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ func init() {
}

for _, site := range list {
fmt.Printf("%-40s [%s]\n", site.Domain, site.TimeAgoInWords)
fmt.Println(site.Domain)
fmt.Printf("%-7s: https://%s\n", "URL", site.Domain)
fmt.Printf("%-7s: https://%s\n", "Preview", site.Preview)
fmt.Printf("v%-7s %-11s %s\n", site.CliVersion, s(site.PublicFileCount), utils.FormatBytes(site.PublicTotalSize))
fmt.Printf("v%-7s %-24s %-15s\n", site.CliVersion,
fmt.Sprintf("%s - %s", s(site.PublicFileCount), utils.FormatBytes(site.PublicTotalSize)),
fmt.Sprintf("[%s]", site.TimeAgoInWords))
// fmt.Printf("%s - %s\n", time.Unix(site.UploadStartTime/1000, 0), time.Unix(site.UploadEndTime/1000, 0))
fmt.Println()
}
Expand Down
5 changes: 4 additions & 1 deletion cli/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ func init() {
return fmt.Errorf("command failed")
}

fmt.Print("Preparing for upload...")
if isSilent == 0 {
fmt.Print("Preparing for upload...")
}

if err := surgesh.Upload(domain, dir, func(byteLine []byte) {
onUploadEvent(byteLine, isSilent > 0)
}); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/charmbracelet/bubbletea v0.25.0 // indirect
github.com/charmbracelet/huh/spinner v0.0.0-20240209193029-45947515c4cf
github.com/charmbracelet/lipgloss v0.9.1 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/containerd/console v1.0.4 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand All @@ -28,7 +28,7 @@ require (
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/rivo/uniseg v0.4.6 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect
golang.org/x/sync v0.6.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1
github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I=
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY=
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=
github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
Expand All @@ -41,6 +43,8 @@ github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.6 h1:Sovz9sDSwbOz9tgUy8JpT+KgCkPYJEN/oYzlJiYTNLg=
github.com/rivo/uniseg v0.4.6/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
Expand Down

0 comments on commit a75fb3d

Please sign in to comment.