diff --git a/.vim/ftplugin/rust.vim b/.vim/ftplugin/rust.vim index 5745b36..e845b95 100644 --- a/.vim/ftplugin/rust.vim +++ b/.vim/ftplugin/rust.vim @@ -3,3 +3,5 @@ if !has('nvim') endif nnoremap :Cargo run + +let g:rustfmt_autosave = 1 diff --git a/config.ini b/config.ini index 5dac812..33bcff4 100644 --- a/config.ini +++ b/config.ini @@ -30,3 +30,5 @@ Vundle.vim=AppData/Local/nvim/bundle/Vundle.vim packer.nvim=AppData/Local/nvim-data/site/pack/packer/start/packer.nvim nvim/lua=AppData/Local/nvim/lua cargo-config.toml=.cargo/config.toml + +[cargo:gitui] diff --git a/installer/__init__.py b/installer/__init__.py index afc82c3..caf0b05 100644 --- a/installer/__init__.py +++ b/installer/__init__.py @@ -16,6 +16,7 @@ from installer import host from installer.options import Options from installer import log from installer import targets +from installer import sections class Installer: """ @@ -32,6 +33,17 @@ class Installer: print("You are not admin: admin is required on Windows") sys.exit(1) + config = self.options.config + for section_name in config.sections(): + try: + T = self.parse_section_name(section_name) + except ValueError as e: + print(f"error reading section: {e}") + continue + section = T.from_section(section_name, **config[section_name]) + print(f"Section: {section}") + section.run() + print("linking in home files") home = self.options.config['home'] home_files = filter(None, home['files'].splitlines()) @@ -95,3 +107,9 @@ class Installer: target_path = pathlib.Path(target_name) print(f"Map {source_path} to {target_path}") self.map_file(source_path, target_path) + + def parse_section_name(self, section_name): + if section_name == "home": + return sections.Home + raise ValueError(f"unprocessable section name: {section_name}") + diff --git a/installer/sections.py b/installer/sections.py new file mode 100644 index 0000000..8c05642 --- /dev/null +++ b/installer/sections.py @@ -0,0 +1,22 @@ +""" +sections defines our various config sections +""" + +import pathlib + +class Home: + """ + the [home] section maps files within the home directory + """ + @classmethod + def from_section(Cls, name, **section): + v = Cls() + if raw_files := section.get('files'): + v.files = filter(None, raw_files.splitlines()) + else: + v.files = None + return v + + def run(self): + pass +