-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy-to-git.py
59 lines (43 loc) · 1.48 KB
/
copy-to-git.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
これは わたし用のプログラムだぜ☆つ(^~^)!
"""
import os
import shutil
import subprocess
source = 'C:/Users/むずでょ/source/repos/pyon-pyon-game'
destination = 'C:/Users/むずでょ/Documents/GitHub/pyon-pyon-game'
def go():
print('Trace | Remove.')
remove_destination_dir('/doc')
remove_destination_dir('/src')
remove_destination_file('/.gitignore')
remove_destination_file('/Cargo.toml')
remove_destination_file('/copy-to-git.py')
remove_destination_file('/LICENSE')
remove_destination_file('/README.md')
print('Trace | Copy.')
copy_dir('/doc')
copy_dir('/src')
copy_file('/.gitignore')
copy_file('/Cargo.toml')
copy_file('/copy-to-git.py')
copy_file('/LICENSE')
copy_file('/README.md')
print('Trace | Git hub.')
subprocess.run(
r"C:\Users\むずでょ\AppData\Local\GitHubDesktop\GitHubDesktop.exe")
print('Trace | Finished.')
def remove_destination_dir(child_path: str):
path = f'{destination}{child_path}'
if os.path.isdir(path):
shutil.rmtree(path)
def remove_destination_file(child_path: str):
path = f'{destination}{child_path}'
if os.path.isfile(path):
os.remove(path)
def copy_dir(child_path: str, ignore=None):
shutil.copytree(f'{source}{child_path}',
f'{destination}{child_path}', ignore=ignore)
def copy_file(child_path: str):
shutil.copy2(f'{source}{child_path}', f'{destination}{child_path}')
go()