|
1 | 1 | #!/bin/bash |
2 | 2 |
|
| 3 | +# NOTE: git.io was deprecated by GitHub in 2022 and no longer works. |
| 4 | +# This script is kept for reference but will not function. |
| 5 | +# Consider using alternatives like: |
| 6 | +# - GitHub's own short URLs (github.com/user/repo) |
| 7 | +# - bit.ly, tinyurl.com, or other URL shorteners |
| 8 | + |
3 | 9 | function _gitio() { |
4 | 10 |
|
5 | 11 | if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP |
6 | | -gitio |
7 | | -http://git.io |
8 | | -
|
9 | | -Usage: gitio <url> [slug] |
10 | | -
|
11 | | -Shorten github url and copies it to clipboard. |
12 | | -
|
13 | | - url (Required) Any github url |
14 | | -
|
15 | | - slug (Optional) The shortname that you want to use. If not provided randomly generated shortname is returned. |
| 12 | +gitio (DEPRECATED) |
16 | 13 |
|
17 | | -Dependencies |
| 14 | +NOTE: git.io was shut down by GitHub in 2022. This script no longer works. |
18 | 15 |
|
19 | | - curl, pbcopy/xclip |
| 16 | +Consider using alternative URL shorteners like bit.ly or tinyurl. |
20 | 17 |
|
21 | | -Copyright (c) 2013 "theskumar" Saurabh Kumar |
22 | | -Licensed under the MIT license. |
| 18 | +Original usage was: gitio <url> [slug] |
23 | 19 | HELP |
24 | 20 | return; fi |
25 | 21 |
|
26 | | -if [ ! "$1" ]; then |
27 | | - echo 'You must specify one or more parameter to run.' |
28 | | - return 1 |
29 | | -fi |
30 | | - |
31 | | -if [ -z "$2" ] ; then |
32 | | - t=$(curl -s -i http://git.io/ -F "url=${1}" 2> /dev/null) |
33 | | -else |
34 | | - t=$(curl -s -i http://git.io/ -F "url=${1}" -F "code=${2}" 2> /dev/null) |
35 | | -fi |
36 | | - |
37 | | -echo "$t" | grep 'Status' |
38 | | -status_code=$(echo "$t" | grep 'Status' | cut -d' ' -f 2) |
39 | | -local status_code |
40 | | -if [ "$status_code" = "201" ] ; then |
41 | | - short_url=$(echo "$t" | grep 'Location' | cut -d' ' -f 2) |
42 | | - echo "$short_url" |
43 | | - |
44 | | - copied="Short URL copied to clipboard!" |
45 | | - command -v pbcopy >& /dev/null && echo "$short_url" | pbcopy && echo "$copied" |
46 | | - command -v xclip >& /dev/null && echo "$short_url" | xclip -selection clipboard && echo "$copied" |
47 | | -fi |
| 22 | +echo "Error: git.io service was deprecated by GitHub in 2022." |
| 23 | +echo "This script no longer works. Consider using bit.ly or tinyurl.com instead." |
| 24 | +return 1 |
48 | 25 | } |
49 | 26 |
|
50 | 27 | # By putting the above code inside a function, if this file is sourced (which |
|
0 commit comments