summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-03-04 11:07:09 +0800
committereltrac <hi@eltr.ac>2026-03-04 11:07:09 +0800
commita5da7777274a108caaa7e360d4986a0457ea8239 (patch)
tree62300852c758d800c7b9f984fc8565035ae96d6d
parent251c3db8a16b433f840b2d836303a72a4a97ddd2 (diff)
feat: support listing all, expired, future and published posts
-rw-r--r--main.go6
-rw-r--r--model_list.go (renamed from model_drafts.go)4
2 files changed, 5 insertions, 5 deletions
diff --git a/main.go b/main.go
index 72f3b23..5eadcfb 100644
--- a/main.go
+++ b/main.go
@@ -14,12 +14,12 @@ func main() {
args := os.Args
if len(args) == 1 {
- p = tea.NewProgram(initialModel())
+ p = tea.NewProgram(listModel("all"))
} else {
subcmd := args[1]
switch subcmd {
- case "drafts":
- p = tea.NewProgram(initialModel())
+ case "drafts", "all", "expired", "future", "published":
+ p = tea.NewProgram(listModel(subcmd))
}
}
diff --git a/model_drafts.go b/model_list.go
index c796e98..f2c6a72 100644
--- a/model_drafts.go
+++ b/model_list.go
@@ -15,8 +15,8 @@ type model struct {
selected map[int]struct{}
}
-func initialModel() model {
- out, err := exec.Command("hugo", "list", "drafts").Output()
+func listModel(arg string) model {
+ out, err := exec.Command("hugo", "list", arg).Output()
if err != nil {
println("Error fetching Hugo drafts: Is this a Hugo site? Is Hugo installed?")
os.Exit(1)