Add tt{l,d,s} to item add command
This commit is contained in:
parent
f7dd694b67
commit
c0d8e8ae31
@ -27,6 +27,9 @@ if it doesn't exist, with a random id.`,
|
||||
stringArg(cmd, "body"),
|
||||
stringArg(cmd, "link"),
|
||||
intArg(cmd, "time"),
|
||||
intArg(cmd, "ttl"),
|
||||
intArg(cmd, "ttd"),
|
||||
intArg(cmd, "tts"),
|
||||
stringArg(cmd, "action"),
|
||||
)
|
||||
},
|
||||
@ -42,6 +45,9 @@ func init() {
|
||||
itemAddCmd.Flags().StringP("body", "b", "", "Item body")
|
||||
itemAddCmd.Flags().StringP("link", "l", "", "Item link")
|
||||
itemAddCmd.Flags().IntP("time", "m", 0, "Item time as a Unix timestamp")
|
||||
itemAddCmd.Flags().Int("ttl", 0, "Item time-to-live in seconds, relative to item creation date")
|
||||
itemAddCmd.Flags().Int("ttd", 0, "Item time-to-die in seconds, relative to item creation date")
|
||||
itemAddCmd.Flags().Int("tts", 0, "Item time-to-show in seconds, relative to item creation date")
|
||||
itemAddCmd.Flags().StringP("action", "x", "", "Item action data as JSON")
|
||||
}
|
||||
|
||||
@ -53,6 +59,9 @@ func itemAdd(
|
||||
body string,
|
||||
link string,
|
||||
time int,
|
||||
ttl int,
|
||||
ttd int,
|
||||
tts int,
|
||||
actions string,
|
||||
) {
|
||||
// Default to "default" source
|
||||
@ -85,6 +94,9 @@ func itemAdd(
|
||||
Body: body,
|
||||
Link: link,
|
||||
Time: time,
|
||||
Ttl: ttl,
|
||||
Ttd: ttd,
|
||||
Tts: tts,
|
||||
Action: itemActions,
|
||||
}}); err != nil {
|
||||
log.Fatalf("error: failed to add item: %s", err)
|
||||
|
@ -19,7 +19,19 @@ tmp/intake item add -s feedtest --title "Title, time" --time 1737780324
|
||||
tmp/intake item add -s feedtest --title "Title, author, body" --author "Authorname" --body "Hello body!"
|
||||
tmp/intake item add -s feedtest --title "Title, author, time, body" --author "Authorname" --time 1700000000 --body "Hello body!"
|
||||
tmp/intake item add -s feedtest --title "Title, time, body" --time 1737780324 --body "Hello, body!"
|
||||
tmp/intake item add -s feedtest --title "TTL 30s" --ttl 30
|
||||
tmp/intake item add -s feedtest --title "TTL 10d" --ttl 864000
|
||||
tmp/intake item add -s feedtest --title "TTD 30s" --ttd 30
|
||||
tmp/intake item add -s feedtest --title "TTS 30s" --tts 30
|
||||
tmp/intake item add -s feedtest --title "TTS -10d" --tts "-864000"
|
||||
|
||||
tmp/intake source add -s spook
|
||||
tmp/intake action add -s spook -a spookier -- jq -c '.title = .title + "o"'
|
||||
tmp/intake item add -s spook --id boo --title "Boo" --action '{"spookier": true}'
|
||||
|
||||
tmp/intake source add -s nothing
|
||||
|
||||
tmp/intake channel add -c all -s feedtest
|
||||
tmp/intake channel add -c all -s spook
|
||||
|
||||
tmp/intake channel add -c none -s nothing
|
||||
|
Loading…
Reference in New Issue
Block a user