Skip to content

hmrg-grmh/ghrepos-cloner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Repos Cloner

clone all repos from a user.

writed in BASH, just a simple tool.

install

  1. download (or just copy) the file github-repos-fun.bash
  2. move it under the path /etc/bash_completion.d

To init it, run command . /etc/bash_completion.d/github-repos-fun.sh
Or just start a new Bash, as like as run the command exec bash

Then, you can run ghrepos-clone to see the help doc, and use it!

e.g.

# install
(cd /etc/bash_completion.d && wget https://ghproxy.com/https://raw.githubusercontent.com/hmrg-grmh/ghrepos-cloner/main/github-repos-fun.bash) &&
# init
exec bash
# see help
ghrepos-clone
# and you will see the outputs ;)

attention

Do not let this file into /etc/profile.d or you will get problem when you use sh!!

in the file /etc/profile we can also see things like that:

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

look, Functions and aliases go in /etc/bashrc, not the profile.
( and in sh, function name can not be like foo-bar. )

other way to install

see the head in /etc/profile , it let us Functions and aliases go in /etc/bashrc, so maybe add to /etc/bash_completion.d is not very currect also ... it just works .

so, you can add it to your ~/.bashrc,
or run this if you would like to create a /etc/bashrc.d such as that :

bashrc-dir-init ()
{
    echo '

## bashrc.d
[[ -d /etc/bashrc.d ]] || { mkdir -p -- /etc/bashrc.d ; touch /etc/bashrc.d/{_.bash,_.sh} ; } ; (cd /etc/bashrc.d && ls -1b -- _.* | tr -- _ \* | xargs | tr -- \  , | xargs -i -- bash -c '"'"'ls -1bd -- /etc/bashrc.d/{{}}'"'"') | while read f ; do source "$f" ; done 
' >> /etc/bashrc &&
    . /etc/bashrc ;
} &&
sudo bash -c "$(declare -f bashrc-dir-init) ; (bashrc-dir-init) ; exit "'$? ;'

and you can add some file like _.foo, then your /etc/bashrc will source the files named *.foo under the dir /etc/bashrc.d also !! 🙃

Well ... infact, I suggest you source it manually if you don't like put it under /etc/bash_completion.d .

requires

In your environment, you must install these commands at first which if not be:

  • bash
  • tee
  • curl
  • jq
  • xargs
  • git

About

Use a bash func to clone repos from a user.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages