Giter VIP home page Giter VIP logo

punktf's Introduction

punktf - A multi-target dotfiles manager

MIT License Continuous Integration rust docs Crates.io Homebrew AUR Chocolatey

Yet another dotfile manager?!

Well, yes, but hear me out: This project was driven by the personal need of having to manage several dotfiles for different machines/targets. You want the same experience everywhere: On your Windows workstation along with an Ubuntu WSL instance, your Debian server and your private Arch installation. This tool fixes that problem while being cross-platform and blazingly fast. You won't need multiple sets of dotfile configurations ever again!

Features:

  • Compile and deploy your dotfiles with one command across different platforms
  • Use handlebar-like instructions to insert variables and compile sections conditionally
  • Define pre- and post-hooks to customize the behavior with your own commands
  • Create multiple profiles for different targets
  • Works on Windows and Linux

Installation

Packaging status

Install punktf using Homebrew on Linux:

brew install michidk/tools/punktf

Install punktf from AUR on Arch Linux.

To install it use your favorite AUR capable package manager (e.g. yay, pikaur):

NOTE: As this builds punktf from source an up-to-date rust installation is needed.

yay punktf

or

pikaur -S punktf

Install punktf using Scoop on Windows:

scoop bucket add shemnei https://github.com/Shemnei/scoop-bucket

scoop install punktf

Install punktf using Chocolatey on Windows:

choco install punktf

Install punktf using cargo and crates.io on Windows and Linux:

cargo install punktf

Building from source

To install punktf from source the following is needed:

  • An up-to-date rust installation
  • An installed nightly toolchain
# Clone
git clone https://github.com/Shemnei/punktf
cd punktf

# Build (cargo)
cargo build --release

Usage

Commands

To deploy a profile, use the deploy subcommand:

# deploy 'windows' profile
punktf deploy --profile windows

# deploy (custom source folder)
punktf deploy --source /home/demo/mydotfiles --profile windows

Adding the -h/--help flag to a given subcommand, will print usage instructions.

Source Folder

The punktf source folder is the folder containing the dotfiles and punktf profiles. We recommend setting the PUNKTF_SOURCE environment variable so that the dotfiles can be compiled using punktf deploy <profile>.

punktf searches for the source folder in the following order:

  1. Paths specified with -s/--source
  2. Paths specified by an environment variable PUNKTF_SOURCE
  3. The current working directory of the shell

The source folder should contain two sub-folders:

  • profiles\: Contains the punktf profile definitions (.yaml or .json)
  • dotfiles\: Contains folders and the actual dotfiles

Example punktf source folder structure:

+ profiles
  + windows.yaml
  + base.yaml
  + arch.json
+ dotfiles
  + .gitconfig
  + init.vim.win
  + base
    + demo.txt
  + linux
    + .bashrc
  + windows
    + alacritty.yml

Target

Determines where punktf will deploy files too. It can be set with:

  1. Variable target in the punktf profile file
  2. Environment variable PUNKTF_TARGET

Profiles

Profiles define which dotfiles should be used. They can be a .json or .yaml file.

Example punktf profile:

variables:
  OS: "windows"

target: "C:\\Users\\Demo"

dotfiles:
  - path: "base"
  - path: "windows/alacritty.yml"
    target:
      path: "C:\\Users\\Demo\\AppData\\Local\\alacritty.yml"
    merge: Ask

links:
  - source_path: "C:\\Users\\Demo\\Dotfiles\\test.txt"
    target_path: "C:\\Users\\Demo\\test.txt"

All properties are explained in the wiki.

Templates

Please refer to the wiki for the templating syntax.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

punktf's People

Contributors

bors[bot] avatar dependabot[bot] avatar michidk avatar shemnei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

punktf's Issues

Deployment fails if `PUNKTF_TARGET` environment variable is not set

Crashes even though target is set in the profile and given as a cli argument.

punktf -v --source . deploy $PROFILE --target . --dry-run
[2021-08-20T17:12:19Z DEBUG punktf] Parsed Opts:
    Opts {
        shared: Shared {
            source: SourcePath(
                ".",
            ),
            verbose: 1,
        },
        command: Deploy(
            Deploy {
                profile: "linux_arch_archx",
                target: Some(
                    ".",
                ),
                dry_run: true,
            },
        ),
    }
The application panicked (crashed).
Message:  No environment variable `PUNKTF_TARGET` set. Either set this variable, use the `-t/--target`
				argument or use the profile attribute `target`.

Setup issue template

There should be a issue template in place before we release v1.0 so if users want to report issues it is done in a streamlined way.

Inject system variables

Maybe punktf should inject some general system variables for templates to use. These will only be accessible by the current process:

  • PUNKTF_OS: OS running the punktf process, like windows, unix, ...
  • PUNKTF_TARGET: Target directory for the profile
  • PUNKTF_SOURCE: Source directory for punktf

Group deployable items by priority and deploy in order

Before starting the deployment, group all items by priority. Then deploy in sorted order (highest first). This allows for specilization of single items (when used together with generic directory deploy) and can reduce disk read/writes.

Final cleanup

Look roughly through every method and check if there is something to clean up or improve

Ability to export/import a profile

Export all files relevant for a profile to be able to share it with other people:

  • Profile itself
  • All items required by the profile
  • Collect needed ENVIRNOMENT variables???

More github actions

  • Action which tests installation
  • Action which tests simple deployment with all cases/options covered

Update README before 1.0

Update README to current state before 1.0 Release.

Also Add:

  • Explaination of PUNKTF_SOURCE/TARGET
  • Setup Instructions
  • Better Profile example?

Check error handling

Check if typical user errors produce readable error messages and not undefined behaviour

Setup Github repo

Set the following description:
⚡ A cross-platform multi-target dotfiles manager

Add the following tags:
rust, dotfiles, cli, dotfile, dotfile-manager

Create symlinks

Have a list of symlinks in the profile that are created during deployment.

In my case, I want to automatically create symlinks in my home folder that link to other files on my system like .ssh config from windows mount to WSL.

Profile aliases

punktf deploy custom-wsl-debian is lengthy to type.
One should be able to set aliase for profiles:

aliases:
- deb
- debian

so I can simply do punktf deploy deb

Add --target

Add a --target cli argument similar to --source.

Check Command

Checks for:

  • Item required by a profile but is missing
  • Invalid templates
  • Items which are not referenced anywhere (no profile requires them)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.