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

Add --text-file option #4

Merged
merged 1 commit into from
Feb 18, 2023
Merged

Add --text-file option #4

merged 1 commit into from
Feb 18, 2023

Conversation

zmoog
Copy link
Owner

@zmoog zmoog commented Feb 18, 2023

Motivation

We want to load the message text from the file, for example:

tgm message send --chat-id 123456 --text-file message.txt

Optionally, user can use the path "-" to load the message from the std instead.

For example:

# use `<`
tgm message send --chat-id 123456 < message.txt

# or use `|`
cat message.txt | tgm message send --chat-id 123456
# or
echo "hey dude, it's me again" | tgm message send --chat-id 123456

# or type your message and send it by typing `CTRL+D`
tgm message send --chat-id 123456
Hey dude, yeah it's me again!
<CTRL+D>

Change description

Load the text message from a stream. The stream can be a file or the stdin.

Additional Notes

Close zmoog/public-notes#4

Reviewer checklist

  • PR address a single concern.
  • PR title and description are appropriately filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.
  • Docs are updated (at least the README.md, if needed).
  • History is clean, commit messages are meaningful (see CONTRIBUTING.md) and are well-formatted.

The message text is loaded from the file path specified, for example:

    tgm message send --chat-id 123456 --text-file message.txt

Optionally, user can use the path "-" to load the message from the std
instead.

For example:

    # use `<`
    tgm message send --chat-id 123456 < message.txt

    # or use `|`
    cat message.txt | tgm message send --chat-id 123456
    # or
    echo "hey dude, it's me again" | tgm message send --chat-id 123456

    # or type your message and send it by typing `CTRL+D`
    tgm message send --chat-id 123456
    Hey dude, yeah it's me again!
    <CTRL+D>

refs: zmoog/public-notes#4
@zmoog zmoog self-assigned this Feb 18, 2023
@zmoog zmoog added the enhancement New feature or request label Feb 18, 2023
@zmoog zmoog marked this pull request as ready for review February 18, 2023 08:56
@zmoog zmoog merged commit ab97b5c into main Feb 18, 2023
@zmoog zmoog deleted the zmoog/text-from-file-or-stdin branch February 18, 2023 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pytest: test input from stdin
1 participant