More generic usage for copy.py.
This commit is contained in:
parent
5679982e1f
commit
518c3e2a7e
21
copy.py
21
copy.py
|
@ -36,9 +36,20 @@ def maybe_copy_dir(src, dest, common):
|
|||
maybe_copy_file(missmatch, join(expanduser('~/'), missmatch))
|
||||
|
||||
|
||||
def parse_args():
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser(description='Interactively copy files.')
|
||||
parser.add_argument('src')
|
||||
parser.add_argument('dest')
|
||||
parser.add_argument('--exclude', help='Exclude those files', nargs='*',
|
||||
default=[])
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main(src, dest, exclude):
|
||||
maybe_copy_dir(expanduser(src), expanduser(dest),
|
||||
set(listdir()) - set(exclude))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
maybe_copy_dir(
|
||||
'./',
|
||||
expanduser('~/'),
|
||||
set(listdir()) - set(('README.md', '.git', 'copy_to_home.py',
|
||||
'install.sh')))
|
||||
main(**vars(parse_args()))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
git clone -q git@github.com:JulienPalard/dotfiles.git /tmp/.dotfiles/ &&
|
||||
cd /tmp/.dotfiles &&
|
||||
./copy_to_home.py &&
|
||||
./copy_to_home.py /tmp/.dotfiles/ ~/ --exclude README.md .git copy.py install.sh &&
|
||||
rm -fr /tmp/.dotfiles/
|
||||
|
|
Loading…
Reference in New Issue