Skip to content

Commit

Permalink
fix: fix template issues
Browse files Browse the repository at this point in the history
  • Loading branch information
b00f committed Jan 8, 2025
1 parent d382b46 commit a222e2d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion internal/engine/command/crowdfund/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ func (c *CrowdfundCmd) createHandler(
return cmd.RenderErrorTemplate(err)
}

return cmd.RenderResultTemplate(".", campaign)
return cmd.RenderResultTemplate("campaign", campaign)
}
10 changes: 8 additions & 2 deletions internal/engine/command/crowdfund/crowdfund.gen.go

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

10 changes: 9 additions & 1 deletion internal/engine/command/crowdfund/crowdfund.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sub_commands:
- name: create
help: Create a new crowdfunding campaign
result_template: |
Crowdfund campaign '{{.Name}}' created successfully with {{ len(.Packages) }} packages
Crowdfund campaign '{{.campaign.Title}}' created successfully with {{ .campaign.Packages | len }} packages
args:
- name: title
desc: The title of this crowdfunding campaign
Expand All @@ -25,6 +25,14 @@ sub_commands:
help: View reports of a crowdfunding campaign
- name: info
help: Get detailed information about a crowdfunding campaign
result_template: |
**{{.campaign.Title}}**
{{.campaign.Desc}}
Packages:
{{range .campaign.Packages}}
- {{.Name}}
{{- end}}
- name: purchase
help: Make a purchase in a crowdfunding campaign
args:
Expand Down
11 changes: 0 additions & 11 deletions internal/engine/command/crowdfund/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ import (
"github.com/pagu-project/pagu/internal/entity"
)

// Add caller.Name here?
const infoResponseTemplate = `
**{{.campaign.Title}}**
{{.campaign.Desc}}
Packages:
{{range .campaign.Packages}}
- {{.Name}}{{end}}
`

func (c *CrowdfundCmd) infoHandler(
_ *entity.User,
cmd *command.Command,
Expand Down

0 comments on commit a222e2d

Please sign in to comment.