-
Notifications
You must be signed in to change notification settings - Fork 25
Output option #10
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
base: master
Are you sure you want to change the base?
Output option #10
Conversation
Prior to this change, any files attached to a message are printed to the
standard output as
```
name: private_url
```
It is then the user's choice to decide how to access the file at the
provided URL.
This change introduces a --output (-o) option that allows the user to
specify a file to download and write all files or named files. By
default nothing is done and the behaviour is the same when the option is
not specified. Otherwise, the string passed to the option is
interpreted as name-value pairs separated by a colon (:), where the name
is the same as reported in slack the slack message and the value is a
file to write the attachment to. If a bare value is specified then it
will match all attachments.
Signed-off-by: Corin Lawson <corin@responsight.com>
|
Thanks for the PR @au-phiware!
Can you please tell me what is your use case, so that we can improve on your solution? Maybe you just want to view the last uploaded file? In such case, would you be ok with saving to disk, with something like: ? |
|
Those are valid points, I guess in those situations the user would just not use the Another feature might be an Regarding specific use cases, I've only just starting using this and the 'pipe into gpg' was certainly the first use case that I came across. |
|
@au-phiware Note that the In this example the I like the idea of having a download manager. We could save files automatically to Regarding output to stdout, there are some cases where it might be useful. However, the |
|
@regisb, yes, I thought your I don't have a lot of time to spare, but I think a "download to directory" would be a fairly simple change, so I'll try and give it a shot. Also, that gpg example in my OP is the real output when building slack-cli from this PR, so it is working and practical. But it relies on the user to get the option right... Here's a more fuller example: |
|
Looks good! The important thing is that we agree on the right CLI options. I'll implement this feature, using your PR as a starting point. |
Thanks for your quick response to #9. This PR implements the kind of thing I had in mind.
It makes this possible:
Please note, this is my first time write any python and I am unaware of its idiosyncrasies, please feel free to make edits. Also, I wasn't sure if that was the best way to get hold of the token.