Coder Social home page Coder Social logo

bhupesh-v / dotman Goto Github PK

View Code? Open in Web Editor NEW
106.0 106.0 18.0 185 KB

dotman is a simple, elegant & easy to use dotfiles manager πŸ––πŸ½

Home Page: https://bhupesh-v.github.io/dotman

License: MIT License

Shell 100.00%
bash configuration-files dotfiles dotfiles-installer dotfiles-linux dotfiles-macos dotfiles-manager dotman hacktoberfest shell shell-script shellscript

dotman's Introduction

dotman's People

Contributors

allcontributors[bot] avatar bhupesh-v avatar prajeshpuri avatar tadomaitis 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dotman's Issues

enable support for system wide dotfiles lookup

dotman works with an assumption that all dotfiles are present inside the $HOME directory.

This might not always be true. For e.g, some user programs store config (or dotfiles) inside the ~/.comfig/ folder as well, An example of this is the neovim default config which is present under .config/nvim/init.vim.

To fix this, we need to search the version of files present inside the user's dotfiles repo to that of inside our system & then check diff.

There can be room for improvement in this as well.

UPDATE: this will also lift the dependency of every filename to start with a . (dotfile, Get it?), i.e dotman would be able to handle your shell scripts as well πŸŽ‰ 🧑

Please comment below what & how will you be approaching this before sending any PRs

automatically push dotfiles to upstream

Right now the user has to manually run the dotman to push changes to upstream.
It would be nice to do this automatically,
This can of course be down through cron jobs but the support is still not there, for e,g

  • Generate an Automated Commit message (Sample commit Automated Commit at <date>)
  • Read/Write cron tab

test dotman on older/newer versions of bash

Right now we are testing dotman for only Bash 4.x (which comes with Ubuntu 20.04. It would be nice to test it on bash 3 and 5 as well. For now, we only need to test syntax as done in the current workflow

name: build

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  linux-test:
    name: Linux Test
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@master
    - name: Run ShellCheck
      uses: ludeeus/[email protected]
    - name: Syntax Testing
      # -n : read  commands  but  do  not  execute  them.  This may be used to check a shell script for syntax errors.  This is ignored by interactive shells.
      run : |
          bash -n dotman.sh
          sh -n tools/install.sh   

This can be done using Bash's official Docker 🐬 Image.
Also, this SO thread can help

add an update script

Is your feature request related to a problem? Please describe.
It would be nice to have an update.sh script in dotman tooling,

  • Users should be able to run, dotman update & the latest changes (any new releases) from the repo should be pulled
  • To be creative, we can create an auto-updater which looks for updates automatically with a certain frequency of days/weeks and prompts user to install the new update.

update tooling, clone only latest tagged release

Cloning tagged release will make a stable & consistent version available version to users.

  1. Find remotes using
git ls-remote --tags https://github.com/Bhupesh-V/tutorialdb.git | tail -1 | awk '{print $2}'
  1. Clone the latest tag.
git clone -b 'v2.0' --single-branch --depth 1 https://github.com/git/git.git

Check if new files are added to dotfiles repo

For newer versions of dotman.
The show diff option may be changed to an Info option instead.
So the idea is every time we find a new untracked file in the dotfiles repo we display it in the terminal

dotman seems unable to execute the add_env function properly

Describe the bug
running dotman the second time I end up in the initial setup again.

  • I found out that apparently the add_env function is not being executed as it should.
  • I guess the variables DOT_REPO and DOT_DEST are somehow known via some declaration within the script and therefore the check [[ "$DOT_DEST" && "$DOT_REPO" ]] && return in line 89 never fails and likewise the rest of the function (with adding those to ~/.bashrc never runs. I could not solve this though

expected behavior
dotman would recognize that it ran alreay and therefore throw me into the regular interface, not the initial setup again and again

To Reproduce
Steps to reproduce the behavior:

  1. sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-v/dotman/master/tools/install.sh)"
  2. cd ~/dotman && mkdir ~/.dotfiles && ./dotman.sh
  3. source ~/.bashrc
  4. ./dotman.sh

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • manjaro,bash: 5.2.15(1)-release
  • ubuntu 22.04, bash: 5.1.16(1)-release

Additional context
I tested this on my local manjaro. As I failed constantly with trying many things to troubleshout and also because am running oh-my-bash there i did another test inside a fresh ubuntutu 22.04 lxc container. Here is what I got there (same behavior).

07:28:22 manolo@manj-laptop dotman Β±|dulhaver_bugfixing βœ—|β†’ lxc exec ubn2204-dotman -- sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-v/dotman/master/tools/install.sh)"
Cloning into 'dotman'...
remote: Enumerating objects: 347, done.
remote: Counting objects: 100% (125/125), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 347 (delta 70), reused 117 (delta 66), pack-reused 222
Receiving objects: 100% (347/347), 142.44 KiB | 1.56 MiB/s, done.
Resolving deltas: 100% (196/196), done.
[βœ”οΈ ] Successfully cloned dβ—‹tman
fatal: '5e0613c3ed47948f63f60461abfc05744237e8b3	refs/tags/v0.3.0' is not a commit and a branch 'master' cannot be created from it
Couldn't set alias for dotman: /root/dotman/dotman.sh
Consider adding it manually.
07:28:58 manolo@manj-laptop dotman Β±|dulhaver_bugfixing βœ—|β†’ lxc exec ubn2204-dotman -- bash
root@ubn2204-dotman:~# cd dotman
root@ubn2204-dotman:~/dotman# ls
CHANGELOG.md  CODE_OF_CONDUCT.md  CONTRIBUTING.md  LICENSE  README.md  assets  dotman.sh  tools
root@ubn2204-dotman:~/dotman# mkdir ~/.dotfiles && ./dotman.sh

Hi  πŸ‘‹
      _       _                         
     | |     | |                        
   __| | ___ | |_ _ __ ___   __ _ _ __  
  / _` |/ _ \| __| `_ ' _ \ / _' | '_ \ 
 | (_| | (_) | |_| | | | | | (_| | | | |
  \__,_|\___/ \__|_| |_| |_|\__,_|_| |_|



First time use πŸ”₯, Set Up dotman
....................................
➀ Enter dotfiles repository URL : https://gitlab.com/dulhaver_devops/dotfiles.git
➀ Where should I clone dotfiles.git (/root/..): .dotfiles

Calling πŸ“ž Git ... 
Cloning into 'dotfiles'...
Username for 'https://gitlab.com': dulhaver
Password for 'https://[email protected]': 
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 2), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (7/7), done.
Resolving deltas: 100% (2/2), done.

[βœ”οΈ ] dotman successfully configured
Open a new terminal or source your shell config

Thanks for using dotman πŸ––.

root@ubn2204-dotman:~/dotman# source ~/.bashrc
root@ubn2204-dotman:~/dotman# ./dotman.sh

Hi  πŸ‘‹
      _       _                         
     | |     | |                        
   __| | ___ | |_ _ __ ___   __ _ _ __  
  / _` |/ _ \| __| `_ ' _ \ / _' | '_ \ 
 | (_| | (_) | |_| | | | | | (_| | | | |
  \__,_|\___/ \__|_| |_| |_|\__,_|_| |_|

First time use πŸ”₯, Set Up dotman
....................................
➀ Enter dotfiles repository URL : 

logo causes errors

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Run dotman.sh (see below)

$ zsh --version
zsh 5.7.1 (x86_64-apple-darwin19.0)

$ dotman/dotman.sh
dotman/dotman.sh: line 15: unexpected EOF while looking for matching ``'
dotman/dotman.sh: line 272: syntax error: unexpected end of file

$ sh

$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.

$ dotman/dotman.sh
dotman/dotman.sh: line 15: unexpected EOF while looking for matching ``'
dotman/dotman.sh: line 272: syntax error: unexpected end of file

Expected behavior
The menu is shown, no errors appear

Desktop (please complete the following information):

  • OS: Max OSX 10.15.5
  • Bash Version: Bash 3.2.57; zsh 5.7.1

echo -e doesn't work on Mac when using bash

Describe the bug
The command echo -e "Some text" writes -e Some text to the screen.

To Reproduce

  1. Run dotman

Expected behavior
The -e is not included in the output

Desktop (please complete the following information):

  • OS: Mac OSX 10.15.5
  • Bash Version: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)

Additional context
Consider using printf instead

[Better way?] Instead of writing the whole dotman script why not use just git?

Atlassian has shown an amazing (possibly the best yet) way to store and share the dotfiles just using git, no wrapper needed. The trick is to use a --bare repository.

The dotman script doesn't extend to multiple surface machines - i.e., if you have configured you dotfiles for ubuntu then how that work on macos? or windows? (there should be some sort of sharing of the files with branching).

Extend the idea like this - https://github.com/kalkayan/dotfiles and you have a dotman without any script and chmod +x (which was the headline of the this repository.

changed git state when user cancels operation

Describe the bug
Changes are committed even though the user opts out of pushing the files to upstream (say for e,g hitting Ctrl+C), this is undesired.

To Reproduce
Steps to reproduce the behavior:

  1. Make some changes to any dotfiles (in your HOME dir)
  2. Run dotman
  3. Choose option 2 to push files upstream
  4. When in Enter Commit Message, hit Ctrl+c
  5. cd to your dotfiles repo & see committed changes

Expected behavior
No changes to the repo should be done until the user enters the commit msg & hits Ctrl+d

initial_setup not passing DOT_REPO to clone_dotrepo

Describe the bug
initial_setup not passing DOT_REPO to clone_dotrepo, missing the $.

To Reproduce
Use initial_setup flow

Expected behavior
Repo is cloned

Actual
Getting:
fatal: repository 'DOT_REPO' does not exist
[❌] DOT_REPO Unavailable. Exiting

PD: Really nice, dotfiles manager πŸ™Œ Thanks!

Not exported DOT_REPO.

Describe the bug
initial_setup not passing DOT_REPO to clone_dotrepo, missing the $.

To Reproduce
Use initial_setup flow

Expected behavior
Repo is cloned

Actual
Getting:
fatal: repository 'DOT_REPO' does not exist
[x] DOT_REPO Unavailable. Exiting

  • OS: Ubuntu 20.04 LTS
  • Bash Version 5.0.17

change show diff option to a more advance version

Is your feature request related to a problem? Please describe.
Currently, the Show diff option only shows diffs b/w files. It would be nice to run git status before it and show necessary info like Untracked files, Default Branch, etc

Describe the solution you'd like
the Show diff option can be renamed to "dotfile repo status" & would include info like:

  • New Files Added (Untracked Files)
  • ...Suggest more ...

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.