We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d4b3899 commit e45a053Copy full SHA for e45a053
0x0
@@ -1,16 +1,30 @@
1
-#!/bin/bash
2
-if [ "$1" == "" ]; then
3
- echo "usage: 0x0 <file or url>"
4
- exit
5
-fi
+#!/usr/bin/env ruby
6
7
-echo "* Uploading: $1"
+args = ARGV
8
9
-if [[ $1 =~ ^https?:// ]]
10
-then
11
- form="url=$1"
12
-else
13
- form="file=@$1"
14
+if args.empty?
+ puts "usage: 0x0 <file or url>"
+ exit 1
+end
15
16
-curl --compressed --progress-bar -F"$form" https://0x0.st | cat
+args.each do |arg|
+
+ puts "* Uploading: #{arg}"
+ if arg =~ %r{^https?://.+}
+ form = "url=#{arg}"
+ else
17
+ form = "file=@#{arg}"
18
+ end
19
20
+ cmd = [
21
+ "curl",
22
+ "--compressed",
23
+ "--progress-bar",
24
+ %{-F#{form}},
25
+ "https://0x0.st"
26
+ ]
27
28
+ IO.popen(cmd, "r") {|io| puts io.read }
29
+ puts
30
0 commit comments