-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
edit: improve stability when files are still being downloaded
- Loading branch information
Showing
6 changed files
with
98 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: release | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set version | ||
run: | ||
with: | ||
go-version: 1.22 | ||
|
||
- name: Check version | ||
run: go version | ||
|
||
- name: Build executables | ||
run: | | ||
export VERSION=${{ github.ref_name }} | ||
sed -i 's/Version = "dev"/Version = "'"$VERSION"'"/' internal/version.go | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
name: Go Test | ||
# name: Go Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
# on: | ||
# push: | ||
# branches: | ||
# - main | ||
|
||
jobs: | ||
test: | ||
name: Test on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
# jobs: | ||
# test: | ||
# name: Test on ${{ matrix.os }} | ||
# runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
# strategy: | ||
# matrix: | ||
# os: [ubuntu-latest, macos-latest] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22' | ||
# - name: Set up Go | ||
# uses: actions/setup-go@v5 | ||
# with: | ||
# go-version: '1.22' | ||
|
||
- name: Install dependencies | ||
run: | | ||
go mod tidy | ||
go mod download | ||
# - name: Install dependencies | ||
# run: | | ||
# go mod tidy | ||
# go mod download | ||
|
||
- name: Run tests | ||
run: go test ./... | ||
# - name: Run tests | ||
# run: go test ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
/* | ||
Copyright © 2024 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "dow", | ||
Short: "move the last downloaded file in the current (or the specified) folder", | ||
Example: "use `dow` or `dow /target/folder` to move the latest file where you want", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return mvCmd.RunE(cmd, args) | ||
}, | ||
} | ||
|
||
func Execute() { | ||
err := mvCmd.Execute() | ||
err := rootCmd.Execute() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func init() {} | ||
func init() { | ||
rootCmd.Root().CompletionOptions.DisableDefaultCmd = true | ||
|
||
rootCmd.Flags().BoolVarP(&verboseFlag, "verbose", "v", false, "show the name of the moved file") | ||
rootCmd.Flags().BoolVarP(&yesFlag, "yes", "y", false, "force dow to move the latest file even if it's old") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/just-hms/dow/internal" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// versionCmd represents the version command | ||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "displays the version of dow", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println(internal.Version) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(versionCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package internal | ||
|
||
var Version = "dev" |