From 3d9596bab71e36ef2e785d87e7473e10e0d0f22b Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 2 Feb 2011 16:22:49 +0100 Subject: add support for URLs to -g and -d Try to extract the ID from URLs like http://paste.xinu.at/1234/ Signed-off-by: Florian Pritz --- fb.in | 10 ++++++++++ fb.pod | 2 ++ 2 files changed, 12 insertions(+) diff --git a/fb.in b/fb.in index 2586667..006d09f 100644 --- a/fb.in +++ b/fb.in @@ -84,6 +84,14 @@ read_stdin() { cat > "$1" } +id_from_arg() { + if echo "$1" | grep -qE "^https?://"; then + echo "$1" | sed -r 's/https?:\/\/[^\/]+\/([^\/]+).*/\1/' + else + echo "$1" + fi +} + help() { cat < will try to extract the ID. -g Download the IDs and output on stdout. Please take care when using this, as binary data can cause unexpected results when being output directly to a terminal. You can no longer upload files in this mode. + If the argument is a URL, C will try to extract the ID. -h Display a short help message. -- cgit v1.2.3-24-g4f1b