Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support multi-lines message for python-bsky-post #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion python-bsky-post/create_bsky_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,20 +357,26 @@ def main():
)
parser.add_argument("--handle", default=os.environ.get("ATP_AUTH_HANDLE"))
parser.add_argument("--password", default=os.environ.get("ATP_AUTH_PASSWORD"))
parser.add_argument("text", default="")
parser.add_argument("--text", default="", help="specify message in single line")
parser.add_argument("--image", action="append")
parser.add_argument("--alt-text")
parser.add_argument("--lang", action="append")
parser.add_argument("--reply-to")
parser.add_argument("--embed-url")
parser.add_argument("--embed-ref")
parser.add_argument("--textfile", type=argparse.FileType("r"), default="-", help="specify textfile for message to post, default:stdin (type CTRL-D for end of message in case of using stdin)")
args = parser.parse_args()
if not (args.handle and args.password):
print("both handle and password are required", file=sys.stderr)
sys.exit(-1)
if args.image and len(args.image) > 4:
print("at most 4 images per post", file=sys.stderr)
sys.exit(-1)
if args.text in ["", None]:
# read text from file
content = args.textfile.read()
args.text = content

create_post(args)


Expand Down