Skip to content

Commit

Permalink
Fix/alfred link (#3)
Browse files Browse the repository at this point in the history
* fix(alfred): ln -s buildDir target

* fix(template): cmd/root.go
  • Loading branch information
cage1016 authored Aug 20, 2023
1 parent 81f1d36 commit f72ae9f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
5 changes: 2 additions & 3 deletions alfred/alfred.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,8 @@ func (a *Alfred) Link() error {
uuid := strings.TrimSpace(string(uuidgen))
target := path.Join(a.WorkflowsPath, "user.workflow."+string(uuid))
logrus.Printf("Creating new link to target %s", target)
buildPath := path.Join(a.WorkflowPath, a.BuildDir)
logrus.Printf("Build path is %s", buildPath)
Run("ln", "-s", buildPath, target)
logrus.Printf("Build path is %s", a.BuildDir)
Run("ln", "-s", a.BuildDir, target)
logrus.Println("created link", filepath.Base(target))

return nil
Expand Down
28 changes: 14 additions & 14 deletions templates/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions templates/tmpl/scriptFilter.root.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@ package cmd

import (
"log"
"os"
"os/exec"
"os"{{if .EnabledAutoUpdate}}"
"os/exec"{{end}}

aw "github.com/deanishe/awgo"
"github.com/deanishe/awgo/update"
"github.com/spf13/cobra"
)

{{if .EnabledAutoUpdate}}const updateJobName = "checkForUpdate"{{end}}

{{if .EnabledAutoUpdate}}const updateJobName = "checkForUpdate"
var (
repo = "{{.GithubRepo}}"
repo = "xxx/ak-test"
wf *aw.Workflow
)

{{if .EnabledAutoUpdate}}func CheckForUpdate() {
func CheckForUpdate() {
if wf.UpdateCheckDue() && !wf.IsRunning(updateJobName) {
log.Println("Running update check in background...")
cmd := exec.Command(os.Args[0], "update")
Expand All @@ -37,15 +35,19 @@ var (
Autocomplete("workflow:update").
Icon(&aw.Icon{Value: "update-available.png"})
}
}{{end}}

}{{else}}
var (
repo = "xxx/ak-test"
wf *aw.Workflow
)
{{end}}
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "{{.Name}}",
Short: "{{.Description}}",
Run: func(cmd *cobra.Command, args []string) {
{{if .EnabledAutoUpdate}}CheckForUpdate(){{end}}
wf.SendFeedback()
{{if .EnabledAutoUpdate}}CheckForUpdate()
wf.SendFeedback(){{else}}wf.SendFeedback(){{end}}
},
}

Expand Down

0 comments on commit f72ae9f

Please sign in to comment.