Skip to content

Feature/Fix: Move to inside you dotfiles from console#142

Closed
gtrabanco wants to merge 162 commits intoCodelyTV:masterfrom
gtrabanco:feature/move_files_dotbot
Closed

Feature/Fix: Move to inside you dotfiles from console#142
gtrabanco wants to merge 162 commits intoCodelyTV:masterfrom
gtrabanco:feature/move_files_dotbot

Conversation

@gtrabanco
Copy link
Contributor

@gtrabanco gtrabanco commented May 13, 2021

Description

This adds new functionality to move files inside your dotfiles and apply a symlink "automatically" and preserve those changes inside your dotfiles. New symlink is applied automatically.

Motivation

Makes more simple and faster to move files inside your dotfiles. This also removes the need of modify your conf.yaml file which is easy to make format errors while editing manually without an editor.

Fixes

New core libraries

files.sh

This is from PR #129 and it is documented there

files::check_if_path_is_older function is not used in this branch but I expect PR #129 to be approved and keep this file as it is there. It is a consistency decision.

dot.sh

Added functions to load libraries that is from PR #129 and it is documented there

output.sh

This is from PR #129 and it is full documented there

New Features

json.sh

  • json::to_yaml convert json to yaml

yaml.sh

  • yaml::to_json convert yaml file to json to manipulate it with jq command

New commands

All these command use symlinks/conf.yaml by default if not argument like --yaml=conf.linux is given. You can also provide a custom path to yaml file like --yaml="/path/to/my.yaml". It should respect the dotbot yaml format. If it is an empty file it will create the necessary directive.

See the help for more options of all command because do more stuff all of them.

dot symlinks link

Move a file in your current work directory in your console to the given path inside your DOTFILES_PATH (relative path).

dot symlinks edit

Edit a current link to a new one and apply it.

dot symlinks delete

Delete a symlink and the stored file.

dot symlinks restore

Move from dotfiles to the link path (destroy the symlink and preserve the file in the deleted link).

Modified commands

dot self install

Added a way to backup files.

dot symlinks apply

Added silent mode.

Other modifications in this feature

Modified how symlinks are applied. Now there are "system" (dotly) symlinks and user symlinks. Stuff that are necessary for dotly to set up as symbolic links are now inside dot self install context folder. This mean that dotfiles_template were modified as well to split symlinks yaml files.

Modified self install to install yq.

Modified update_all to update yq.

Tasks

  • Add needed core libraries from feature/core (only needed parts).
  • Add new core libraries.
  • Backup when using dot self install.
  • Add link symlinks script.
  • Add edit symlinks script.
  • Add delete symlinks script.
  • Add restore symlinks script.
  • Install yq.
  • Add yq to update all.
  • Document in this PR all new stuff.
  • Manual testing.

About merging this branch

If PR #129 is approved then next files must be discarded:

  • scripts/core/dot.sh
  • scripts/core/files.sh
  • scripts/core/output.sh

Because probably are more updated in the PR #129

gtrabanco and others added 30 commits February 13, 2021 17:45
…res/fixes in other PRs. Added feature of autoupdate dotly
…otly, fixed all the way init-scripts were loaded because they fail. Fixed some issues.
* Added new functions to get the current script_name or script_path where the functions were run
* Added function to conver mayus to lower
`mas` has added support for Apple Silicon: mas-cli/mas#310
…led (#107)

Co-authored-by: David Asensio Cañas <david.asensio@lifullconnect.com>
In case of having multiple Cargo dependencies installed such as:

```sh
{▸} ~ cargo install --list
docpars v0.2.0:
    docpars
git-delta v0.6.0:
    delta
```

The previous command was passing out multiple lines:

```sh
{▸} ~ cargo install --list | grep -E '^[a-z0-9_-]+ v[0-9.]+:$' | cut -f1 -d' '
docpars
git-delta
```

Because of these lines were being received by the very same `cargo install` command, it was failing:

```sh
{▸} ~ cargo install "$(cargo install --list | grep -E '^[a-z0-9_-]+ v[0-9.]+:$' | cut -f1 -d' ')"
    Updating crates.io index
error: could not find `docpars
git-delta` in registry `https://github.com/rust-lang/crates.io-index` with version `*`
```

Now, it executes the `cargo install` multiple times, but at least do not produce crashes 😅

```sh
{▸} ~ cargo install --list | grep -E '^[a-z0-9_-]+ v[0-9.]+:$' | cut -f1 -d' ' | xargs -n1 cargo install
    Updating crates.io index
     Ignored package `docpars v0.2.0` is already installed, use --force to override
    Updating crates.io index
     Ignored package `git-delta v0.6.0` is already installed, use --force to override
```
Having pip3 installed does not imply having defined any dependencies for python. This change avoids crashing while running the `up` command. We were crashing because of the combination of `set -euo pipefail` with an empty input for the `grep -v '^\-e'` 🤟
Added script 'dot symlinks update'
* Fix errors with symlinks update script when files are symbolic links
* Fix non alphanumeric names of files
…ates can apply its own symlinks without adding files in symlinks subfolder
…so use it without copying files to the init-scripts folder

Added a CHANGELOG
* When you have problems of file permissions of autocompletions or any zsh file
  you can solve those errors by executing this subcommand.
Merged official dotly master branch in this branch.
@gtrabanco
Copy link
Contributor Author

Refactor necessary. I found a bug using paths with spaces. Uncheked tests task.

gtrabanco and others added 20 commits June 9, 2021 02:15
- Fixed error getting `brew --prefix` because PATH is not defined yet when we need to get it.
- Fixed error in shell/bash/init.sh because xargs did not have the argument -0 (NUL error)
xargs: WARNING: a NUL character occurred in the input.  It cannot be passed through in the argument list.  Did you mean to use the --null option?
@gtrabanco gtrabanco closed this Jun 14, 2021
@gtrabanco gtrabanco deleted the feature/move_files_dotbot branch June 14, 2021 22:04
@gtrabanco gtrabanco restored the feature/move_files_dotbot branch June 23, 2021 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing backup for existing files

6 participants