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

Improve transfer function to support stdin #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anihm136
Copy link

Fixes dutchcoders/transfer.sh#413

Allows transfer function to take input from stdin

@aspacca
Copy link
Collaborator

aspacca commented Mar 3, 2022

hello @anihm136

sorry for the long time taking to review your PR

$ source .bash_profile
-bash: .bash_profile: line 1: syntax error near unexpected token `('
-bash: .bash_profile: line 1: `transfer() { local file local file_name file="§1" [ -n "§file" ] && file_name=§(basename "§file") || file_name="" if tty -s; then if [ §# -eq 0 ]; then echo "No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>" >&2 return 1 fi if [ ! -e "§file" ]; then echo "§file: No such file or directory" >&2 return 1 fi if [ -d "§file" ]; then file_name="§file_name.zip" , (cd "§file" && zip -r -q - .) | curl --progress-bar --upload-file "-" "https://transfer.sh/§file_name" | tee /dev/null,         else              cat "§file" | curl --progress-bar --upload-file "-" "https://transfer.sh/§file_name" | tee /dev/null         fi else if [ -z "§file_name" ] && [ ! -t 0 ]; then file_name=§(mktemp -u "tmpXXXXXXXXXX") elif [ -t 0 ]; then echo "No data provided.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>" >&2 return 1 fi curl --progress-bar --upload-file "-" "https://transfer.sh/§file_name" | tee /dev/null fi }'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Read in from stdin/pipe
2 participants