2020-07-25 04:50:30 +02:00
|
|
|
from PyInquirer import prompt
|
|
|
|
import os
|
|
|
|
from shutil import copyfile
|
2020-07-25 12:35:33 +02:00
|
|
|
from print_helpers import print_gr, print_fail
|
2020-07-25 04:50:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
class BashrcModule:
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
bashrc_path = os.path.join(os.path.expanduser('~'), ".bashrc")
|
|
|
|
bashrc_exists = os.path.exists(bashrc_path)
|
|
|
|
|
|
|
|
if bashrc_exists:
|
|
|
|
print_gr(f"Found .bashrc in {bashrc_path}")
|
|
|
|
ask_to_keep = {
|
|
|
|
'type': 'confirm',
|
|
|
|
'message': 'Do you want to overwrite the existing .bashrc?',
|
|
|
|
'name': 'overwrite',
|
|
|
|
'default': False,
|
|
|
|
}
|
|
|
|
if not prompt(ask_to_keep)['overwrite']:
|
|
|
|
print_fail("Stopping")
|
|
|
|
return
|
|
|
|
|
|
|
|
copyfile("./modules/bashrc/bashrc_default", bashrc_path)
|
2020-07-25 12:35:33 +02:00
|
|
|
print_gr("Successfully overwritten .bashrc!") if bashrc_exists else print_gr(f"Successfully created .bashrc!")
|