change arguments
This commit is contained in:
parent
654c2b8307
commit
6d0fafdd00
@ -16,11 +16,13 @@ buttons used to navigate the list are similar to `less`. here are the keys you c
|
|||||||
* g: go to top
|
* g: go to top
|
||||||
* G: go to bottom
|
* G: go to bottom
|
||||||
|
|
||||||
|
`~nebula/bink --help`: returns a link to this page
|
||||||
|
|
||||||
`~nebula/bink this is my post!` or `~nebula/bink "this is also a post!"` will write all the words passed into it as a post for everyone else to see
|
`~nebula/bink this is my post!` or `~nebula/bink "this is also a post!"` will write all the words passed into it as a post for everyone else to see
|
||||||
|
|
||||||
`~nebula/bink pipe`: allow standard input to be the post body, eg. `echo "hello world!" | ~nebula/bink pipe`
|
`~nebula/bink --pipe`: allow standard input to be the post body, eg. `echo "hello world!" | ~nebula/bink pipe`
|
||||||
|
|
||||||
`~nebula/bink dump`: dumps all post data to a json object
|
`~nebula/bink --dump`: dumps all post data to a json object
|
||||||
|
|
||||||
## object logic
|
## object logic
|
||||||
|
|
||||||
|
36
bink.py
36
bink.py
@ -50,25 +50,25 @@ def generate_feed(before=None, count=200):
|
|||||||
blogs.append(obj)
|
blogs.append(obj)
|
||||||
return blogs
|
return blogs
|
||||||
|
|
||||||
if argv[-1] == "--help" or argv[-1] == "help":
|
|
||||||
exit("see https://git.tilde.town/nebula/bink for usage instructions")
|
|
||||||
elif argv[-1] == "dump":
|
|
||||||
with open("/dev/stdout", "w") as f:
|
|
||||||
json.dump(generate_feed(), f)
|
|
||||||
exit()
|
|
||||||
elif argv[-1] == "pipe":
|
|
||||||
try:
|
|
||||||
with open("/dev/stdin", "r", encoding="UTF-8") as f:
|
|
||||||
body = f.read().strip()
|
|
||||||
if body:
|
|
||||||
create_post(body)
|
|
||||||
exit()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
exit()
|
|
||||||
|
|
||||||
if len(argv) > 1:
|
if len(argv) > 1:
|
||||||
create_post(" ".join(argv[1:]))
|
if argv[1] == "--help":
|
||||||
exit()
|
exit("see https://git.tilde.town/nebula/bink for usage instructions")
|
||||||
|
elif argv[1] == "--dump":
|
||||||
|
with open("/dev/stdout", "w") as f:
|
||||||
|
json.dump(generate_feed(), f)
|
||||||
|
exit()
|
||||||
|
elif argv[1] == "--pipe":
|
||||||
|
try:
|
||||||
|
with open("/dev/stdin", "r", encoding="UTF-8") as f:
|
||||||
|
body = f.read().strip()
|
||||||
|
if body:
|
||||||
|
create_post(body)
|
||||||
|
exit()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
exit()
|
||||||
|
else:
|
||||||
|
create_post(" ".join(argv[1:]))
|
||||||
|
exit()
|
||||||
|
|
||||||
import urwid
|
import urwid
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user