Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
d776ae46
Commit
d776ae46
authored
Apr 10, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: move scat/sget/check to url_ namespace and add default wrapper
parent
c9ba7ce1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
12 deletions
+27
-12
tools_eget
bin/tools_eget
+27
-12
No files found.
bin/tools_eget
View file @
d776ae46
...
...
@@ -375,16 +375,17 @@ done
WGET
=
"
$(
print_command_path wget
)
"
if
is_fileurl
"
$1
"
;
then
# put remote content to stdout
scat
()
url_
scat
()
{
local
URL
=
"
$1
"
cat
"
$(
path_from_url
"
$URL
"
)
"
}
# download to default name of to $2
sget
()
url_
sget
()
{
local
URL
=
"
$1
"
if
[
"
$2
"
=
"/dev/stdout"
]
||
[
"
$2
"
=
"-"
]
;
then
...
...
@@ -397,7 +398,7 @@ sget()
cp
-av
"
$(
path_from_url
"
$URL
"
)
"
.
}
check_url_is_accessible
()
url_check
()
{
local
URL
=
"
$1
"
test
-f
"
$(
path_from_url
"
$URL
"
)
"
...
...
@@ -406,13 +407,13 @@ check_url_is_accessible()
elif
is_ipfsurl
"
$1
"
;
then
# put remote content to stdout
scat
()
url_
scat
()
{
local
URL
=
"
$1
"
a
=
ipfs
cat
"
$(
cid_from_url
"
$URL
"
)
"
}
# download to default name of to $2
sget
()
url_
sget
()
{
local
URL
=
"
$1
"
if
[
"
$2
"
=
"/dev/stdout"
]
||
[
"
$2
"
=
"-"
]
;
then
...
...
@@ -425,7 +426,7 @@ sget()
a
=
ipfs get
"
$(
path_from_url
"
$URL
"
)
"
}
check_url_is_accessible
()
url_check
()
{
local
URL
=
"
$1
"
# TODO: improve me
...
...
@@ -443,13 +444,13 @@ __wget()
}
# put remote content to stdout
scat
()
url_
scat
()
{
local
URL
=
"
$1
"
download_with_mirroring __wget
"
$URL
"
-O-
}
# download to default name of to $2
sget
()
url_
sget
()
{
local
URL
=
"
$1
"
if
[
"
$2
"
=
"/dev/stdout"
]
||
[
"
$2
"
=
"-"
]
;
then
...
...
@@ -466,7 +467,7 @@ sget()
download_with_mirroring __wget
"
$URL
"
$WGETNAMEOPTIONS
}
check_url_is_accessible
()
url_check
()
{
local
URL
=
"
$1
"
__wget
--spider
-S
"
$URL
"
2>&1 |
grep
"HTTP/"
|
tail
-n1
|
grep
-q
"200"
...
...
@@ -484,13 +485,13 @@ __curl()
fi
}
# put remote content to stdout
scat
()
url_
scat
()
{
local
URL
=
"
$1
"
download_with_mirroring __curl
"
$URL
"
--output
-
}
# download to default name of to $2
sget
()
url_
sget
()
{
local
URL
=
"
$1
"
local
res
...
...
@@ -505,7 +506,7 @@ sget()
download_with_mirroring __curl
"
$URL
"
$CURLNAMEOPTIONS
}
check_url_is_accessible
()
url_check
()
{
local
URL
=
"
$1
"
__curl
-LI
"
$URL
"
2>&1 |
grep
"HTTP/"
|
tail
-n1
|
grep
-q
-w
"200
\|
404"
...
...
@@ -515,6 +516,20 @@ fi
scat
()
{
url_scat
"
$@
"
}
sget
()
{
url_sget
"
$@
"
}
check_url_is_accessible
()
{
url_check
"
$@
"
}
get_github_urls
()
{
# https://github.com/OWNER/PROJECT
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment