mirror of
https://github.com/jessebot/dot_files.git
synced 2025-10-01 01:48:43 +00:00
make .git_dot_files directory configurable
This commit is contained in:
parent
1908510dac
commit
8b70bb6187
7 changed files with 308 additions and 369 deletions
111
README.md
111
README.md
|
@ -66,7 +66,11 @@ If you haven't already made the switch from Vim to [NeoVim], you can try out Neo
|
|||
<details>
|
||||
<summary><h4>Easy <code>yaml</code> config files using XDG Base Directory Spec<h4></summary>
|
||||
|
||||
We use use [XDG Base Directory Spec] for [config files](#configuration) so you always know where they are :)
|
||||
We use use [XDG Base Directory Spec] for config files, so you always know where they are :)
|
||||
|
||||
Config files are in `$XDG_CONFIG_HOME/onboardme/`, <sub>or `~/.config/onboardme/` if `$XDG_CONFIG_HOME` is not defined</sub>.
|
||||
|
||||
Learn more about configuration in the [config docs](https://jessebot.github.io/onboardme/onboardme/getting-started).
|
||||
|
||||
</details>
|
||||
|
||||
|
@ -195,13 +199,15 @@ pip install --user --upgrade onboardme
|
|||
Read more about our docker tags and how to use them at [jessebot/onboardme](https://hub.docker.com/r/jessebot/onboardme) on DockerHub.
|
||||
|
||||
# Usage
|
||||
Learn more about configuration in the [config docs](https://jessebot.github.io/onboardme/onboardme/getting-started), but by default you can get started with:
|
||||
|
||||
_Now_ you can run `onboardme` 🎉
|
||||
```bash
|
||||
# this will display the help text for onboardme
|
||||
onboardme --help
|
||||
|
||||
# Running this won't overwrite any existing dot files, but it may add new ones.
|
||||
# Running this won't overwrite any existing dot files, but it may add new ones
|
||||
# and it may install new packages. Don't run this till you've looked at the files
|
||||
# in ~/.config/onboardme/
|
||||
onboardme
|
||||
```
|
||||
|
||||
|
@ -221,105 +227,6 @@ If you're on python 3.11, you should be able to do:
|
|||
pip3.11 install --upgrade onboardme
|
||||
```
|
||||
|
||||
### Configuration
|
||||
onboardme has lots of CLI options, but you can also use config files. You have to create these files for the time being.
|
||||
|
||||
Config files are in `$XDG_CONFIG_HOME/onboardme/`, <sub>or `~/.config/onboardme/` if `$XDG_CONFIG_HOME` is not defined</sub>.
|
||||
|
||||
| Config File | Description |
|
||||
|:------------------------------------------|:----------------------------------------------------|
|
||||
| `$XDG_CONFIG_HOME/onboardme/config.yml` | For step configuration to run either all steps, or just a subset. |
|
||||
| `$XDG_CONFIG_HOME/onboardme/packages.yml` | For adding packages with different package managers |
|
||||
|
||||
Examples:
|
||||
<details>
|
||||
<summary><code>~/.config/onboardme/config.yml</code></summary>
|
||||
|
||||
```yaml
|
||||
---
|
||||
# ______________________________________________________________ #
|
||||
# Config file for the onboardme cli command. #
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
|
||||
# - If this files exists as: ~/.config/onboardme/config.yaml #
|
||||
# then its loaded instead of the default config #
|
||||
# -------------------------------------------------------------- #
|
||||
|
||||
|
||||
log:
|
||||
# Full path to a file you'd like to log to. Creates file if it doesn't exist
|
||||
file: ""
|
||||
# what level of logs to output (debug, info, warn, error)
|
||||
level: "warn"
|
||||
|
||||
# steps refer to a specific function in the list of functions we run
|
||||
steps:
|
||||
# these are mac specific steps
|
||||
Darwin:
|
||||
- dot_files
|
||||
- packages
|
||||
- font_setup
|
||||
- neovim_setup
|
||||
- sudo_setup
|
||||
# these are linux specific steps
|
||||
Linux:
|
||||
- dot_files
|
||||
- packages
|
||||
- font_setup
|
||||
- neovim_setup
|
||||
- group_setup
|
||||
|
||||
dot_files:
|
||||
# personal git repo URL for your dot files, defaults to jessebot/dot_files
|
||||
git_url: "https://github.com/jessebot/dot_files.git"
|
||||
# the branch to use for the git repo above, defaults to main
|
||||
git_branch: "main"
|
||||
# !!CAREFUL: runs a `git reset --hard`, which will overwite/delete files in
|
||||
# $HOME that conflict with the above defined git repo url and branch.
|
||||
# You should run the following to get the files that would be overwritten:
|
||||
# onboardme -s dot_files
|
||||
# if set to true, then using onboardme -O will toggle it back to false
|
||||
overwrite: false
|
||||
|
||||
# This is the basic package config.
|
||||
package:
|
||||
# Remove any of the below pkg managers to only run the remaining pkg managers
|
||||
managers:
|
||||
# macOS specific steps
|
||||
Darwin:
|
||||
- brew
|
||||
- pip3.11
|
||||
# Debian/Ubuntu specific steps
|
||||
Linux:
|
||||
- apt
|
||||
- brew
|
||||
- pip3.11
|
||||
- flatpak
|
||||
- snap
|
||||
# list of extra existing packages groups to install
|
||||
groups:
|
||||
default:
|
||||
# basic tui stuff to have a nice time in the terminal :)
|
||||
- default
|
||||
# move these package.groups.default to always install them
|
||||
optional:
|
||||
# setting up more python data science specific tooling
|
||||
- data_science
|
||||
# kubernetes and docker tools
|
||||
- devops
|
||||
# gaming always installs gui
|
||||
- gaming
|
||||
# freetube and other gui applications
|
||||
- gui
|
||||
# this configures neomutt and offlineimap
|
||||
- mail
|
||||
# sets up useful music tui stuff for spotify and youtube
|
||||
- music
|
||||
# things like zoom and slack
|
||||
- work
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Under the Hood
|
||||
Made and tested for these operating systems:
|
||||
|
||||
|
|
253
docs/onboardme/configuration.md
Normal file
253
docs/onboardme/configuration.md
Normal file
|
@ -0,0 +1,253 @@
|
|||
---
|
||||
layout: default
|
||||
title: Getting Started
|
||||
parent: getting-started
|
||||
permalink: /onboardme/config
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
### CLI
|
||||
|
||||
For the full help, you can check out the `--help` option. If anything there is
|
||||
unclear, please feel free to open up [an issue](https://github.com/onboardme/issues)
|
||||
and we can clear it up for you and make the help text, more helpful :)
|
||||
|
||||
```bash
|
||||
onboardme --help
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Full Help Text</summary>
|
||||
|
||||
[<img src='https://raw.githubusercontent.com/jessebot/onboardme/main/docs/onboardme/screenshots/help_text.svg' alt='screenshot of full output of onboardme --help'>](https://raw.githubusercontent.com/jessebot/onboardme/main/docs/onboardme/screenshots/help_text.svg)
|
||||
|
||||
</details>
|
||||
|
||||
### Config files
|
||||
|
||||
`onboardme` uses a `config.yml` in its installation directory that has defaults.
|
||||
Those defaults can be altered per machine by creating a config file like:
|
||||
|
||||
<details>
|
||||
<summary><code>~/.config/onboardme/config.yml</code></summary>
|
||||
|
||||
```yaml
|
||||
---
|
||||
# ______________________________________________________________ #
|
||||
# Config file for the onboardme cli command. #
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
|
||||
# - If this files exists as: ~/.config/onboardme/config.yaml #
|
||||
# then its loaded instead of the default config #
|
||||
# -------------------------------------------------------------- #
|
||||
|
||||
|
||||
log:
|
||||
# Full path to a file you'd like to log to. Creates file if it doesn't exist
|
||||
file: ""
|
||||
# what level of logs to output (debug, info, warn, error)
|
||||
level: "warn"
|
||||
|
||||
# steps refer to a specific function in the list of functions we run
|
||||
steps:
|
||||
# these are mac specific steps
|
||||
Darwin:
|
||||
- dot_files
|
||||
- packages
|
||||
- font_setup
|
||||
- neovim_setup
|
||||
- sudo_setup
|
||||
# these are linux specific steps
|
||||
Linux:
|
||||
- dot_files
|
||||
- packages
|
||||
- font_setup
|
||||
- neovim_setup
|
||||
- group_setup
|
||||
|
||||
dot_files:
|
||||
# personal git repo URL for your dot files, defaults to jessebot/dot_files
|
||||
git_url: "https://github.com/jessebot/dot_files.git"
|
||||
# the branch to use for the git repo above, defaults to main
|
||||
git_branch: "main"
|
||||
# this is where the actual git config for your dot files lives
|
||||
# it can't live in ~/.git because that will affect _everything_ under ~/
|
||||
git_config_dir: "~/.config/dot_files"
|
||||
# !!CAREFUL: runs a `git reset --hard`, which will overwite/delete files in
|
||||
# $HOME that conflict with the above defined git repo url and branch.
|
||||
# You should run the following to get the files that would be overwritten:
|
||||
# onboardme -s dot_files
|
||||
# if set to true, then using onboardme -O will toggle it back to false
|
||||
overwrite: false
|
||||
|
||||
# This is the basic package config.
|
||||
package:
|
||||
# Remove any of the below pkg managers to only run the remaining pkg managers
|
||||
managers:
|
||||
# macOS specific steps
|
||||
Darwin:
|
||||
- brew
|
||||
- pip3.11
|
||||
# Debian/Ubuntu specific steps
|
||||
Linux:
|
||||
- apt
|
||||
- brew
|
||||
- pip3.11
|
||||
- flatpak
|
||||
- snap
|
||||
# list of extra existing packages groups to install
|
||||
groups:
|
||||
default:
|
||||
# basic tui stuff to have a nice time in the terminal :)
|
||||
- default
|
||||
# move these package.groups.default to always install them
|
||||
optional:
|
||||
# setting up more python data science specific tooling
|
||||
- data_science
|
||||
# kubernetes and docker tools
|
||||
- devops
|
||||
# gaming always installs gui
|
||||
- gaming
|
||||
# freetube and other gui applications
|
||||
- gui
|
||||
# this configures neomutt and offlineimap
|
||||
- mail
|
||||
# sets up useful music tui stuff for spotify and youtube
|
||||
- music
|
||||
# things like zoom and slack
|
||||
- work
|
||||
```
|
||||
|
||||
If the comments in this configuration file are unclear, please feel free to
|
||||
open up [an issue](https://github.com/onboardme/issues) and we'll help! :)
|
||||
|
||||
</details>
|
||||
|
||||
We also use a package file called
|
||||
[`packages.yml`](https://github.com/jessebot/dot_files/blob/main/.config/onboardme/packages.yml)
|
||||
which you can also place in your `~/.config/onboardme` directory, to take
|
||||
precedence over our defaults.
|
||||
|
||||
## Config Sections and Explanations
|
||||
### Steps
|
||||
Steps refer to a specific function in the list of functions we run and can be
|
||||
configured for both macOS and Linux seperately. These steps include:
|
||||
|
||||
- setting up dot files in your home directory (.bashrc, etc)
|
||||
- managing packages using package managers (brew, pip3.11, apt, snap, flatpak)
|
||||
- installing fonts
|
||||
- setting up basic TUI IDE, neovim
|
||||
- setting up groups
|
||||
|
||||
They can be configured via the `steps` parameter in the `config.yml` above,
|
||||
or via the the cli like:
|
||||
|
||||
```bash
|
||||
# this runs only the dot_file management step
|
||||
onboardme -s dot_files
|
||||
```
|
||||
|
||||
or for multiple steps:
|
||||
|
||||
```bash
|
||||
# this runs both the dot_file management step and the neovim setup step
|
||||
onboardme -s dot_files -s neovim_setup
|
||||
```
|
||||
|
||||
If you try to run a step that requires another step, we will automatically run
|
||||
that step so for instance, to set up neovim, we need dot files. e.g.
|
||||
|
||||
This command: `onboardme -s neovim_setup`
|
||||
|
||||
In the background becomes: `onboardme -s dot_files -s neovim_setup`
|
||||
|
||||
### dot files
|
||||
The dot files for your home directory are installed from a git URL and branch
|
||||
that you can configure either via the config file, or the cli. If your local
|
||||
files conflict with the files in the repo, we will not overwrite them by default.
|
||||
If you always want your local dot files overwritten, you can pass in the `-O` switch
|
||||
or `--overwrite` option or set `overwrite` in your local `~/.config/onboardme/config.yml`.
|
||||
|
||||
### `onboardme` cli
|
||||
```bash
|
||||
# run onboardme with a custom git url and branch that overwrites existing files
|
||||
# and use the ~/.config/dot_files dir for storing the git config for the dot files
|
||||
onboardme --git_url https://github.com/jessebot/dot_files.git \
|
||||
--git_branch main \
|
||||
--git_config_dir ~/.config/dot_files \
|
||||
--overwrite
|
||||
```
|
||||
|
||||
### `config.yml`
|
||||
|
||||
```yaml
|
||||
dot_files:
|
||||
git_url: "https://github.com/jessebot/dot_files.git"
|
||||
git_branch: "main"
|
||||
overwrite: true
|
||||
```
|
||||
|
||||
|
||||
### Package Management
|
||||
All of the packages are installed using package managers, and each package
|
||||
manager has groups of packages they can install. You can specify specific
|
||||
package _managers_ and package _groups_ via the `config.yml` file, or via the cli.
|
||||
|
||||
By default, we install the `default` package _groups_ for all package _managers_.
|
||||
This includes everything you need for a basic cli experience and a slim ide.
|
||||
|
||||
The default package managers for macOS and Linux are: `brew` and `pip3.11`
|
||||
|
||||
For Linux, we also include: `apt`, `snap`, and `flatpak`
|
||||
|
||||
See the examples below:
|
||||
|
||||
#### Install the "default" and "gui" package groups
|
||||
This would install the default packages for the basic cli experience and a
|
||||
slim ide PLUS GUI tools, like vlc and freetube.
|
||||
|
||||
##### `onboardme` cli
|
||||
|
||||
```bash
|
||||
# can also be: onboardme -g default -g gui
|
||||
onboardme --pkg_groups default --pkg_groups gui
|
||||
```
|
||||
|
||||
##### `config.yml`
|
||||
|
||||
```yaml
|
||||
package:
|
||||
groups:
|
||||
default:
|
||||
- default
|
||||
- gui
|
||||
```
|
||||
|
||||
#### _Only_ install the "devops" package group for _only_ the `brew` package manager
|
||||
This will install only additional tooling for devops work.
|
||||
_Note: This will not install/upgrade the default package group._
|
||||
|
||||
##### `onboardme` cli
|
||||
|
||||
```bash
|
||||
# can also be: onboardme -p brew -g devops
|
||||
onboardme --pkg_managers brew --pkg_groups devops
|
||||
```
|
||||
|
||||
##### `config.yml`
|
||||
|
||||
```yaml
|
||||
package:
|
||||
managers:
|
||||
Darwin:
|
||||
- brew
|
||||
Linux:
|
||||
- brew
|
||||
groups:
|
||||
default:
|
||||
- devops
|
||||
# none of the packages below will be run be default, but can specified via the cli
|
||||
optional:
|
||||
- gui
|
||||
- work
|
||||
```
|
|
@ -8,247 +8,13 @@ permalink: /onboardme/getting-started
|
|||
|
||||
# Quick Start
|
||||
|
||||
If you haven't already, please refer to the
|
||||
[install instructions](https://jessebot.github.io/onboardme/onboardme/getting-started/installation) 🌱.
|
||||
If you haven't already, please refer to the 🌱
|
||||
[install instructions](https://jessebot.github.io/onboardme/onboardme/getting-started/installation) and ⚙️ [Configuration](https://jessebot.github.io/onboardme/onboardme/config).
|
||||
|
||||
You can run `onboardme` with no options or further configuration, and it will
|
||||
not overwrite anything, but it will install packages and attempt to configure
|
||||
fonts, neovim, and give you further instructions to setup your machine on your own.
|
||||
|
||||
See below for configuration with cli options or a config file :)
|
||||
|
||||
## Configuration
|
||||
|
||||
### CLI
|
||||
|
||||
For the full help, you can check out the `--help` option. If anything there is
|
||||
unclear, please feel free to open up [an issue](https://github.com/onboardme/issues)
|
||||
and we can clear it up for you and make the help text, more helpful :)
|
||||
|
||||
```bash
|
||||
onboardme --help
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Full Help Text</summary>
|
||||
|
||||
[<img src='https://raw.githubusercontent.com/jessebot/onboardme/main/docs/onboardme/screenshots/help_text.svg' alt='screenshot of full output of onboardme --help'>](https://raw.githubusercontent.com/jessebot/onboardme/main/docs/onboardme/screenshots/help_text.svg)
|
||||
|
||||
</details>
|
||||
|
||||
### Config files
|
||||
|
||||
`onboardme` uses a `config.yml` in its installation directory that has defaults.
|
||||
Those defaults can be altered per machine by creating a config file like:
|
||||
|
||||
<details>
|
||||
<summary><code>~/.config/onboardme/config.yml</code></summary>
|
||||
|
||||
```yaml
|
||||
---
|
||||
# ______________________________________________________________ #
|
||||
# Config file for the onboardme cli command. #
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
|
||||
# - If this files exists as: ~/.config/onboardme/config.yaml #
|
||||
# then its loaded instead of the default config #
|
||||
# -------------------------------------------------------------- #
|
||||
|
||||
|
||||
log:
|
||||
# Full path to a file you'd like to log to. Creates file if it doesn't exist
|
||||
file: ""
|
||||
# what level of logs to output (debug, info, warn, error)
|
||||
level: "warn"
|
||||
|
||||
# steps refer to a specific function in the list of functions we run
|
||||
steps:
|
||||
# these are mac specific steps
|
||||
Darwin:
|
||||
- dot_files
|
||||
- packages
|
||||
- font_setup
|
||||
- neovim_setup
|
||||
- sudo_setup
|
||||
# these are linux specific steps
|
||||
Linux:
|
||||
- dot_files
|
||||
- packages
|
||||
- font_setup
|
||||
- neovim_setup
|
||||
- group_setup
|
||||
|
||||
dot_files:
|
||||
# personal git repo URL for your dot files, defaults to jessebot/dot_files
|
||||
git_url: "https://github.com/jessebot/dot_files.git"
|
||||
# the branch to use for the git repo above, defaults to main
|
||||
git_branch: "main"
|
||||
# !!CAREFUL: runs a `git reset --hard`, which will overwite/delete files in
|
||||
# $HOME that conflict with the above defined git repo url and branch.
|
||||
# You should run the following to get the files that would be overwritten:
|
||||
# onboardme -s dot_files
|
||||
# if set to true, then using onboardme -O will toggle it back to false
|
||||
overwrite: false
|
||||
|
||||
# This is the basic package config.
|
||||
package:
|
||||
# Remove any of the below pkg managers to only run the remaining pkg managers
|
||||
managers:
|
||||
# macOS specific steps
|
||||
Darwin:
|
||||
- brew
|
||||
- pip3.11
|
||||
# Debian/Ubuntu specific steps
|
||||
Linux:
|
||||
- apt
|
||||
- brew
|
||||
- pip3.11
|
||||
- flatpak
|
||||
- snap
|
||||
# list of extra existing packages groups to install
|
||||
groups:
|
||||
default:
|
||||
# basic tui stuff to have a nice time in the terminal :)
|
||||
- default
|
||||
# move these package.groups.default to always install them
|
||||
optional:
|
||||
# setting up more python data science specific tooling
|
||||
- data_science
|
||||
# kubernetes and docker tools
|
||||
- devops
|
||||
# gaming always installs gui
|
||||
- gaming
|
||||
# freetube and other gui applications
|
||||
- gui
|
||||
# this configures neomutt and offlineimap
|
||||
- mail
|
||||
# sets up useful music tui stuff for spotify and youtube
|
||||
- music
|
||||
# things like zoom and slack
|
||||
- work
|
||||
```
|
||||
|
||||
If the comments in this configuration file are unclear, please feel free to
|
||||
open up [an issue](https://github.com/onboardme/issues) and we'll help! :)
|
||||
|
||||
</details>
|
||||
|
||||
We also use a package file called
|
||||
[`packages.yml`](https://github.com/jessebot/dot_files/blob/main/.config/onboardme/packages.yml)
|
||||
which you can also place in your `~/.config/onboardme` directory, to take
|
||||
precedence over our defaults.
|
||||
|
||||
## Config Sections and Explanations
|
||||
### Steps
|
||||
Steps refer to a specific function in the list of functions we run and can be
|
||||
configured for both macOS and Linux seperately. These steps include:
|
||||
|
||||
- setting up dot files in your home directory (.bashrc, etc)
|
||||
- managing packages using package managers (brew, pip3.11, apt, snap, flatpak)
|
||||
- installing fonts
|
||||
- setting up basic TUI IDE, neovim
|
||||
- setting up groups
|
||||
|
||||
They can be configured via the `steps` parameter in the `config.yml` above,
|
||||
or via the the cli like:
|
||||
|
||||
```bash
|
||||
# this runs only the dot_file management step
|
||||
onboardme -s dot_files
|
||||
```
|
||||
|
||||
or for multiple steps:
|
||||
|
||||
```bash
|
||||
# this runs both the dot_file management step and the neovim setup step
|
||||
onboardme -s dot_files -s neovim_setup
|
||||
```
|
||||
|
||||
If you try to run a step that requires another step, we will automatically run
|
||||
that step so for instance, to set up neovim, we need dot files. e.g.
|
||||
|
||||
This command: `onboardme -s neovim_setup`
|
||||
|
||||
In the background becomes: `onboardme -s dot_files -s neovim_setup`
|
||||
|
||||
### dot files
|
||||
The dot files for your home directory are installed from a git URL and branch
|
||||
that you can configure either via the config file, or the cli. If your local
|
||||
files conflict with the files in the repo, we will not overwrite them by default.
|
||||
If you always want your local dot files overwritten, you can pass in the `-O` switch
|
||||
or `--overwrite` option or set `overwrite` in your local `~/.config/onboardme/config.yml`.
|
||||
|
||||
### `onboardme` cli
|
||||
```bash
|
||||
# run onboardme with a custom git url and branch that overwrites existing files
|
||||
onboardme --git_url https://github.com/jessebot/dot_files.git --git_branch main --overwrite
|
||||
```
|
||||
|
||||
### `config.yml`
|
||||
|
||||
```yaml
|
||||
dot_files:
|
||||
git_url: "https://github.com/jessebot/dot_files.git"
|
||||
git_branch: "main"
|
||||
overwrite: true
|
||||
```
|
||||
|
||||
|
||||
### Package Management
|
||||
All of the packages are installed using package managers, and each package
|
||||
manager has groups of packages they can install. You can specify specific
|
||||
package _managers_ and package _groups_ via the `config.yml` file, or via the cli.
|
||||
|
||||
By default, we install the `default` package _groups_ for all package _managers_.
|
||||
This includes everything you need for a basic cli experience and a slim ide.
|
||||
|
||||
The default package managers for macOS and Linux are: `brew` and `pip3.11`
|
||||
|
||||
For Linux, we also include: `apt`, `snap`, and `flatpak`
|
||||
|
||||
See the examples below:
|
||||
|
||||
#### Install the "default" and "gui" package groups
|
||||
This would install the default packages for the basic cli experience and a
|
||||
slim ide PLUS GUI tools, like vlc and freetube.
|
||||
|
||||
##### `onboardme` cli
|
||||
|
||||
```bash
|
||||
# can also be: onboardme -g default -g gui
|
||||
onboardme --pkg_groups default --pkg_groups gui
|
||||
```
|
||||
|
||||
##### `config.yml`
|
||||
|
||||
```yaml
|
||||
package:
|
||||
groups:
|
||||
default:
|
||||
- default
|
||||
- gui
|
||||
```
|
||||
|
||||
#### _Only_ install the "devops" package group for _only_ the `brew` package manager
|
||||
This will install only additional tooling for devops work.
|
||||
_Note: This will not install/upgrade the default package group._
|
||||
|
||||
##### `onboardme` cli
|
||||
|
||||
```bash
|
||||
# can also be: onboardme -p brew -g devops
|
||||
onboardme --pkg_managers brew --pkg_groups devops
|
||||
```
|
||||
|
||||
##### `config.yml`
|
||||
|
||||
```yaml
|
||||
package:
|
||||
managers:
|
||||
Darwin:
|
||||
- brew
|
||||
Linux:
|
||||
- brew
|
||||
groups:
|
||||
default:
|
||||
- devops
|
||||
onboardme
|
||||
```
|
||||
|
|
|
@ -112,6 +112,11 @@ def setup_logger(level="", log_file=""):
|
|||
metavar='BRANCH',
|
||||
help=HELP['git_branch'],
|
||||
default=USR_CONFIG_FILE['dot_files']['git_branch'])
|
||||
@option('--git_config_dir',
|
||||
'-b',
|
||||
metavar='PATH',
|
||||
help=HELP['git_config_dir'],
|
||||
default=USR_CONFIG_FILE['dot_files']['git_config_dir'])
|
||||
@option('--overwrite',
|
||||
'-O',
|
||||
is_flag=True,
|
||||
|
@ -153,7 +158,7 @@ def setup_logger(level="", log_file=""):
|
|||
default=False)
|
||||
def main(log_level, log_file,
|
||||
steps,
|
||||
git_url, git_branch, overwrite,
|
||||
git_url, git_branch, git_config_dir, overwrite,
|
||||
pkg_managers, pkg_groups,
|
||||
firewall, remote_host,
|
||||
no_upgrade,
|
||||
|
@ -177,8 +182,10 @@ def main(log_level, log_file,
|
|||
log = setup_logger(log_level, log_file)
|
||||
|
||||
# makes sure we only overwrite config file prefs if cli opts are passed in
|
||||
usr_pref = process_configs(overwrite, git_url, git_branch, pkg_managers,
|
||||
pkg_groups, firewall, remote_host, steps,
|
||||
usr_pref = process_configs(overwrite, git_url, git_branch, git_config_dir,
|
||||
pkg_managers, pkg_groups,
|
||||
firewall, remote_host,
|
||||
steps,
|
||||
log_file, log_level)
|
||||
|
||||
if log:
|
||||
|
@ -193,7 +200,8 @@ def main(log_level, log_file,
|
|||
# this creates a live git repo out of your home directory
|
||||
df_prefs = usr_pref['dot_files']
|
||||
setup_dot_files(OS, df_prefs['overwrite'],
|
||||
df_prefs['git_url'], df_prefs['git_branch'])
|
||||
df_prefs['git_url'], df_prefs['git_branch'],
|
||||
df_prefs['git_config_dir'])
|
||||
|
||||
elif step == 'packages':
|
||||
pkg_mngrs = usr_pref['package']['managers'][OS[0]]
|
||||
|
|
|
@ -13,33 +13,38 @@ from .console_logging import print_panel, print_msg
|
|||
from .subproc import subproc
|
||||
|
||||
|
||||
XDG_GIT_CFG_DIR = path.join(XDG_CONFIG_DIR, 'git')
|
||||
Path(XDG_GIT_CFG_DIR).mkdir(exist_ok=True)
|
||||
XDG_GIT_PATH = path.join(XDG_GIT_CFG_DIR, 'config')
|
||||
xdg_git_config_dir = path.join(XDG_CONFIG_DIR, 'git')
|
||||
Path(xdg_git_config_dir).mkdir(exist_ok=True)
|
||||
XDG_GIT_CONFIG = path.join(xdg_git_config_dir, 'config')
|
||||
|
||||
|
||||
def setup_dot_files(OS='Linux', overwrite=False,
|
||||
def setup_dot_files(OS='Linux',
|
||||
overwrite=False,
|
||||
git_url="https://github.com/jessebot/dot_files.git",
|
||||
branch="main") -> None:
|
||||
branch="main",
|
||||
dot_files_cfg_dir=f"{XDG_CONFIG_DIR}/dot_files") -> None:
|
||||
"""
|
||||
note on how we're doing things, seperate dot files repo:
|
||||
https://probablerobot.net/2021/05/keeping-'live'-dotfiles-in-a-git-repo/
|
||||
|
||||
|
||||
"""
|
||||
git_dir = path.join(HOME_DIR, '.git_dot_files')
|
||||
# create ~/.git_dot_files if it does not exist
|
||||
Path(git_dir).mkdir(exist_ok=True)
|
||||
chdir(git_dir)
|
||||
opts = {'quiet': True, 'cwd': git_dir}
|
||||
# create dot_files_cfg_dir if it doesn't exist/don't complain if it does
|
||||
# defaults to ~/.config/dot_files
|
||||
Path(dot_files_cfg_dir).mkdir(parents=True, exist_ok=True)
|
||||
chdir(dot_files_cfg_dir)
|
||||
opts = {'quiet': True, 'cwd': dot_files_cfg_dir}
|
||||
|
||||
if git_url:
|
||||
if "github.com" in git_url:
|
||||
# get just the owner/repo_name like jessebot/dot_files
|
||||
user_repo = "/".join(git_url.split("/")[-2:]).replace(".git", "")
|
||||
|
||||
# global: use main as default branch, always push up new remote branch
|
||||
git_raw = f"https://raw.githubusercontent.com/{user_repo}/{branch}"
|
||||
|
||||
cmds = [f'curl {git_raw}/.config/git/config -o {XDG_GIT_PATH}',
|
||||
f'git --git-dir={git_dir} --work-tree={HOME_DIR} init',
|
||||
cmds = [f'curl {git_raw}/.config/git/config -o {XDG_GIT_CONFIG}',
|
||||
f'git --git-dir={dot_files_cfg_dir} --work-tree={HOME_DIR} init',
|
||||
'git config status.showUntrackedFiles no']
|
||||
subproc(cmds, spinner=False, **opts)
|
||||
|
||||
|
|
|
@ -41,15 +41,6 @@ def options_help() -> dict:
|
|||
pkg_group_choices = pretty_choices(DEFAULT_PKG_GROUPS + OPT_PKG_GROUPS)
|
||||
|
||||
return {
|
||||
'log_level':
|
||||
f'Logging level. {logging_choices}\nDefault: [meta]warn[/meta]',
|
||||
|
||||
'log_file':
|
||||
'Full path to file to log to, if set.',
|
||||
|
||||
'quiet':
|
||||
"unstable. Don't output to stdout. ",
|
||||
|
||||
'steps':
|
||||
f'[b]Only[/b] run [meta]STEP[/] in the script.\n{step_choices}\nExampl'
|
||||
'e: [switch]-s[/] [meta]dot_files[/] [switch]-s[/] [meta]packages',
|
||||
|
@ -85,6 +76,16 @@ def options_help() -> dict:
|
|||
|
||||
'version':
|
||||
f'Print the version of onboardme ({VERSION})'
|
||||
|
||||
'log_level':
|
||||
f'Logging level. {logging_choices}\nDefault: [meta]warn[/meta]',
|
||||
|
||||
'log_file':
|
||||
'Full path to file to log to, if set.',
|
||||
|
||||
'quiet':
|
||||
"unstable. Don't output to stdout. ",
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,8 +128,8 @@ class RichCommand(click.Command):
|
|||
row_styles=["", "dim"],
|
||||
padding=(1, 1, 0, 0))
|
||||
|
||||
# this used to be self.get_params(ctx)[1:] and I don't know why
|
||||
for param in self.get_params(ctx):
|
||||
# this used to be self.get_params(ctx)[1:] to have only one hidden option
|
||||
for param in self.get_params(ctx)[2:]:
|
||||
|
||||
if len(param.opts) == 2:
|
||||
opt1 = highlighter(param.opts[1])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "onboardme"
|
||||
version = "1.4.1"
|
||||
version = "1.5.0"
|
||||
description = "Install dot files and packages, including a base mode with sensible defaults to run on most computers running Debian based distros or macOS."
|
||||
authors = [
|
||||
"Jesse Hitch <jessebot@linux.com>",
|
||||
|
@ -19,8 +19,7 @@ classifiers = ["Development Status :: 3 - Alpha",
|
|||
"Topic :: System :: Installation/Setup",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)"]
|
||||
packages = [{include = "onboardme"}]
|
||||
include = ["onboardme/scripts/update_apt_sources.sh",
|
||||
"onboardme/scripts/get_apt_list.sh"]
|
||||
include = ["onboardme/scripts/update_apt_sources.sh"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue