Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
f68d65d3
Unverified
Commit
f68d65d3
authored
Jun 12, 2021
by
Mitchel Humpherys
Committed by
GitHub
Jun 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(take): add support to `take' for taking remote urls (#2029)
Download, extract, and cd into the resulting directory. Co-authored-by:
Mitchel Humpherys
<
mitchelh@codeaurora.org
>
parent
a3d90624
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
functions.zsh
lib/functions.zsh
+25
-1
No files found.
lib/functions.zsh
View file @
f68d65d3
...
...
@@ -13,7 +13,7 @@ function upgrade_oh_my_zsh() {
omz update
}
function
take
()
{
function
take
dir
()
{
mkdir
-p
$@
&&
cd
${
@
:
$#}
}
...
...
@@ -37,6 +37,30 @@ function open_command() {
${
=open_cmd
}
"
$@
"
&>/dev/null
}
function
takeurl
()
{
data
=
$(
mktemp
)
curl
-L
$1
>
$data
tar
xf
$data
thedir
=
$(
tar
tf
$data
|
head
-1
)
rm
$data
cd
$thedir
}
function
takegit
()
{
git clone
$1
cd
$(
basename
${
1
%%.git
})
}
function
take
()
{
if
[[
$1
=
~ ^
(
https?|ftp
)
.
*
\.
tar
\.
(
gz|bz2|xz
)
$
]]
;
then
takeurl
$1
elif
[[
$1
=
~ ^
([
A-Za-z0-9]
\+
@|https?|git|ssh|ftps?|rsync
)
.
*
\.
git/?
$
]]
;
then
takegit
$1
else
takedir
$1
fi
}
#
# Get the value of an alias.
#
...
...
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