Skip to content

Conversation

@gtrabanco
Copy link
Contributor

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.

lazy symlinks link

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

lazy symlinks edit

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

lazy symlinks delete

Delete a symlink and the stored file.

lazy symlinks restore

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

Modified commands

lazy self install

Added a way to backup files.

lazy 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.

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 and others added 28 commits June 9, 2021 15:51
- 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?
Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
* Paths are now loaded before everything

* Core update, adding some functions that will be used with other features/fixes in other PRs. Added feature of autoupdate dotly

* Improved output::join with a stackoverflow function in: https://stackoverflow.com/a/17841619
Removed duplicate functions

* Added closed and unapproved PR #61 because it is needed when I use beta branch for testing and developing.

* Added a way to modify DOTFILES_PATH structure when add a feature to dotly, fixed all the way init-scripts were loaded because they fail. Fixed some issues.

* Added some core functions:
* Added new functions to get the current script_name or script_path where the functions were run
* Added function to conver mayus to lower

* Fix git pretty-log when commit is a branch (#100)

* 🍎 Install `mas` even on Apple Silicon (arm64) (#102)

`mas` has added support for Apple Silicon: mas-cli/mas#310

* Trigger `dot` command using `ctr+f`

* Use Volta instead of NPM to dump global packages in case it is installed (#107)

Co-authored-by: David Asensio Cañas <david.asensio@lifullconnect.com>

* [📦 rust] Fix crash while updating cargo dependencies (#113)

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
```

* [🐍 python] Avoid crash in case of not having python dependencies (#111)

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 async library
Added script 'dot symlinks update'

* Enable/disable autoload scripts can be symlinks

* Fixed error #93 with bash autocompletions

* Autoupdate

* Added folder for use with script 'dot symlinks update'
* Fix errors with symlinks update script when files are symbolic links
* Fix non alphanumeric names of files

* Added warning when no GITHUB_TOKEN is set

* Repetitive stuff should be in a loop

* Added support in update symlinks for symlinks, so now scripts and updates can apply its own symlinks without adding files in symlinks subfolder

* Support for symlinks and files as init scripts, so now scripts can also use it without copying files to the init-scripts folder
Added a CHANGELOG

* Added a new subcommand for script 'dot shell zsh': 'fix_permissions'
* When you have problems of file permissions of autocompletions or any zsh file
  you can solve those errors by executing this subcommand.

* Added a way to deactivate init scripts

* Use {▪} icon for prompt error status (#128)

Merged official dotly master branch in this branch.

* Removed unneded variable

* Fixed unbound variables

* Solved end / in url makes api call fail

* Not necessary lib

* Removed not needed variable

* Not needed file

* Renamed utils to src as PR #140

* Fixed to avoid unbound variable

* Changes in autoupdate
- Now github API is not needed for autoupdate
- Update minor right way but need tagged commits
- Update stable only to tagged versions
- Update to latest commit in master as always did

* Added 'dot self version' to choose your running DOTLY version

* Added more options to 'dot self version'

* Solved issues with libraries

* Feat/Fix migration and how libraries are loaded
- Moved functions from platform to dot
- Now added a function to load sandboxed libraries in context
- Migrate all scripts of this feature to use function to load sandboxed libraries
- Added migration script
- Renamed dotbot migration file
- Added option to no warn user about dotbot migration changes

* Added a way to try to guess if migration script is necessary

* Added migration script

* Fixed templating

* Fixed .zshrc file

* Updated init-dotly for zsh

* Updated init-dotly for bash

* Fix migration scripts
Final formating for dot self update

* Added gitignore to migration script, added dotbot migration yaml

* Added zsh test back

* Fixed to add automatically $HOME var when tamplating if path is inside your home

* Fixed zsh theme for autoupdate. Fix Format in .gitignore

* Fixed copy paste error for zsh DOTLY loading

* Fixed function name. It must be called autoupdate instead of update

* Modified to use the new way of load sandboxed libraries

* Added second optional param to dot::get_script_src_path
 - Now end .sh is optional but recommended
 - Now firstly it will try to load from Dotly core (for optional core libs)
 - Secondly it will try to load from directory 'src' in given path as second argument or current script path
 - Finally it will try to load from given path or inside the current script path

* Modified how libraries are loaded second step and later. Final work is:
1. Try to load from dotly core for not added in _main libraries (optionals)
2. Try to load from current script context 'src' subfolder
3. Try to load from a given context as second argument 'src' folder
4. If the second argument is not a context and library is not ther it will manage the second argument as a directory where the lib in the first argument should be.

* Check for variables or default value

* Deleted platform function from output.sh

* Removed not need of restore start working directory

* Fixed unbound variable

* Fixed dot::get_script_src_path lib loading

- Changed load priority. If second parameter is given it should be in the first place.
- Fixed loading libraries when not .sh was provided.
- Added `SCRIPT_LOADED_LIBS` variable to avoid duplicate loading of libs.

* Added default theme codely

* Fixed error when LOADED_LIBS does not have any library yet

* Fix(core): Dotfiles, core and variables
- Changed the way how dotly is loaded
- Removed dotfiles_template/shell/init.sh
- Changed JAVA_HOME
- Conditional add to PATH of `JAVA_HOME`, `GEM_HOME` and `GOHOME`
- Fixed core library `array.sh` were not loaded.
- Fixed in the `_main.sh` the alphabetical order were not preserved for `output.sh`
- Fixed functions that were required for dotly were in the user `functions.sh` instead in the core loading file. Now these functions are in `shell/init-dotly.sh` and `shell/zsh/init.sh`.
- Fixed not default theme were provided in bash.
- `dot::get_script_src_path` should be the recommended way to load a lib in any script. Maybe these functions should be directly available in `dot` command.
- Minor change in migration script to export current `PATH` directories

* Provided default values to all variables in output. Changed $1 for $* to accept all params in text functions

* Added brew autocompletions for bash and zsh
Changed the way bash autocompletions are loaded
Some fixes in reverse-search internal variables
Added shellcheck ignores when needed in dotly loader
Added handle errors when loading files
Init scripts now with find which enable it to use non alphabetical path names
Moved to init-dotly.sh aliases.sh and functions.sh

* Added double quotes in _main for DOTLY_PATH because it can contain non alphabetical chars

* Improved output::join with a stackoverflow function in: https://stackoverflow.com/a/17841619
Removed duplicate functions

* Added closed and unapproved PR #61 because it is needed when I use beta branch for testing and developing.

* Added a way to modify DOTFILES_PATH structure when add a feature to dotly, fixed all the way init-scripts were loaded because they fail. Fixed some issues.

* Added some core functions:
* Added new functions to get the current script_name or script_path where the functions were run
* Added function to conver mayus to lower

* Added async library
Added script 'dot symlinks update'

* Some changes in templating::replace_var

* Fixed dot::get_script_src_path wrong call to SCRIPT_LOADED_LIBS. Also changed the way the variable is initialized

* Changed how check if a value exists in an array

* Fixed that init script were not initilizing

* Moved init dis/enable scripts
Some fixes in library
Some changes in dotly-init.sh

* Fixed dot self migration

* Changed the usage of output::clarification to output::write

* Deleted output::clarification

* Fixed error message when enabled init-script does not exists

* output::question output::question_default output::yesno Change them could broke many scripts

* Fixed enable when select multiple script to enable

* Fixed path error for zsh brew autocompletions

* Fix update when no update yaml file is given and no choose in fzf selection

* Changed the name of dot::get_script_src_path to dot::load_library.

* Fixed NUL character ocurred in the input

* Fixed copy&paste error

* Update comment

* Fixed how path is loaded in dotly initializer. Fixed BASH shell loading zsh in macOS

* Fix: PATHS and BASH
- 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)

* Added GPG_TTY in init-dotly because it fails if I add it later

* Added open command

* Fixed no solved merge conflict

* Fix xargs issue without -0 option
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?

* The libs were not be added to SCRIPT_LOADED_LIBS

* Output compatibility with dotly. Modified dot command to lazy command

* [Feature] Create scripts from terminal (#8)

* Added dotly core scripts to create scripts

* Added output library from PR 129

* Update function dot::get_script_src_path

* Fixed error when LOADED_LIBS does not have any library yet

* Restored templating, dot and output from master to avoid merging problems

* Added shellcheck to template, added check of DOTLY_PATH in scripts

* Fixed minor issue in docopt script definition

* Changed the name of dot::get_script_src_path to dot::load_library.

* Added option to create script in $DOTFILES_PATH/bin

* Fixed variable name

* Fixed no chmod were applied before

* Fixed no new line were added before load dotly core

* Renamed to sloth

* Added output.sh library from feature/core because we do not want to modify it

Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>

Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
Co-authored-by: Henry Palacios <henrydpalacios@gmail.com>
Co-authored-by: Javier Ferrer <javier.mailserio@gmail.com>
Co-authored-by: Rafa Gómez <rgomezcasas@gmail.com>
Co-authored-by: David Asensio Cañas <david.asensio@icloud.com>
Co-authored-by: David Asensio Cañas <david.asensio@lifullconnect.com>
Co-authored-by: Daniel Santamaría <santaka87@gmail.com>
* Removed git 'binaries'

* Moved brew to package because it is not mac exclusive package manager

Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
* Paths are now loaded before everything

* Core update, adding some functions that will be used with other features/fixes in other PRs. Added feature of autoupdate dotly

* Improved output::join with a stackoverflow function in: https://stackoverflow.com/a/17841619
Removed duplicate functions

* Added closed and unapproved PR #61 because it is needed when I use beta branch for testing and developing.

* Added a way to modify DOTFILES_PATH structure when add a feature to dotly, fixed all the way init-scripts were loaded because they fail. Fixed some issues.

* Added some core functions:
* Added new functions to get the current script_name or script_path where the functions were run
* Added function to conver mayus to lower

* Fix git pretty-log when commit is a branch (#100)

* 🍎 Install `mas` even on Apple Silicon (arm64) (#102)

`mas` has added support for Apple Silicon: mas-cli/mas#310

* Trigger `dot` command using `ctr+f`

* Use Volta instead of NPM to dump global packages in case it is installed (#107)

Co-authored-by: David Asensio Cañas <david.asensio@lifullconnect.com>

* [📦 rust] Fix crash while updating cargo dependencies (#113)

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
```

* [🐍 python] Avoid crash in case of not having python dependencies (#111)

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 async library
Added script 'dot symlinks update'

* Enable/disable autoload scripts can be symlinks

* Fixed error #93 with bash autocompletions

* Autoupdate

* Added folder for use with script 'dot symlinks update'
* Fix errors with symlinks update script when files are symbolic links
* Fix non alphanumeric names of files

* Added warning when no GITHUB_TOKEN is set

* Repetitive stuff should be in a loop

* Added support in update symlinks for symlinks, so now scripts and updates can apply its own symlinks without adding files in symlinks subfolder

* Support for symlinks and files as init scripts, so now scripts can also use it without copying files to the init-scripts folder
Added a CHANGELOG

* Added a new subcommand for script 'dot shell zsh': 'fix_permissions'
* When you have problems of file permissions of autocompletions or any zsh file
  you can solve those errors by executing this subcommand.

* Added a way to deactivate init scripts

* Use {▪} icon for prompt error status (#128)

Merged official dotly master branch in this branch.

* Removed unneded variable

* Fixed unbound variables

* Solved end / in url makes api call fail

* Not necessary lib

* Removed not needed variable

* Not needed file

* Renamed utils to src as PR #140

* Fixed to avoid unbound variable

* Changes in autoupdate
- Now github API is not needed for autoupdate
- Update minor right way but need tagged commits
- Update stable only to tagged versions
- Update to latest commit in master as always did

* Added 'dot self version' to choose your running DOTLY version

* Added more options to 'dot self version'

* Solved issues with libraries

* Feat/Fix migration and how libraries are loaded
- Moved functions from platform to dot
- Now added a function to load sandboxed libraries in context
- Migrate all scripts of this feature to use function to load sandboxed libraries
- Added migration script
- Renamed dotbot migration file
- Added option to no warn user about dotbot migration changes

* Added a way to try to guess if migration script is necessary

* Added migration script

* Fixed templating

* Fixed .zshrc file

* Updated init-dotly for zsh

* Updated init-dotly for bash

* Fix migration scripts
Final formating for dot self update

* Added gitignore to migration script, added dotbot migration yaml

* Added zsh test back

* Fixed to add automatically $HOME var when tamplating if path is inside your home

* Fixed zsh theme for autoupdate. Fix Format in .gitignore

* Fixed copy paste error for zsh DOTLY loading

* Fixed function name. It must be called autoupdate instead of update

* Modified to use the new way of load sandboxed libraries

* Added second optional param to dot::get_script_src_path
 - Now end .sh is optional but recommended
 - Now firstly it will try to load from Dotly core (for optional core libs)
 - Secondly it will try to load from directory 'src' in given path as second argument or current script path
 - Finally it will try to load from given path or inside the current script path

* Modified how libraries are loaded second step and later. Final work is:
1. Try to load from dotly core for not added in _main libraries (optionals)
2. Try to load from current script context 'src' subfolder
3. Try to load from a given context as second argument 'src' folder
4. If the second argument is not a context and library is not ther it will manage the second argument as a directory where the lib in the first argument should be.

* Check for variables or default value

* Deleted platform function from output.sh

* Removed not need of restore start working directory

* Fixed unbound variable

* Fixed dot::get_script_src_path lib loading

- Changed load priority. If second parameter is given it should be in the first place.
- Fixed loading libraries when not .sh was provided.
- Added `SCRIPT_LOADED_LIBS` variable to avoid duplicate loading of libs.

* Added default theme codely

* Fixed error when LOADED_LIBS does not have any library yet

* Fix(core): Dotfiles, core and variables
- Changed the way how dotly is loaded
- Removed dotfiles_template/shell/init.sh
- Changed JAVA_HOME
- Conditional add to PATH of `JAVA_HOME`, `GEM_HOME` and `GOHOME`
- Fixed core library `array.sh` were not loaded.
- Fixed in the `_main.sh` the alphabetical order were not preserved for `output.sh`
- Fixed functions that were required for dotly were in the user `functions.sh` instead in the core loading file. Now these functions are in `shell/init-dotly.sh` and `shell/zsh/init.sh`.
- Fixed not default theme were provided in bash.
- `dot::get_script_src_path` should be the recommended way to load a lib in any script. Maybe these functions should be directly available in `dot` command.
- Minor change in migration script to export current `PATH` directories

* Provided default values to all variables in output. Changed $1 for $* to accept all params in text functions

* Added brew autocompletions for bash and zsh
Changed the way bash autocompletions are loaded
Some fixes in reverse-search internal variables
Added shellcheck ignores when needed in dotly loader
Added handle errors when loading files
Init scripts now with find which enable it to use non alphabetical path names
Moved to init-dotly.sh aliases.sh and functions.sh

* Added double quotes in _main for DOTLY_PATH because it can contain non alphabetical chars

* Improved output::join with a stackoverflow function in: https://stackoverflow.com/a/17841619
Removed duplicate functions

* Added closed and unapproved PR #61 because it is needed when I use beta branch for testing and developing.

* Added a way to modify DOTFILES_PATH structure when add a feature to dotly, fixed all the way init-scripts were loaded because they fail. Fixed some issues.

* Added some core functions:
* Added new functions to get the current script_name or script_path where the functions were run
* Added function to conver mayus to lower

* Added async library
Added script 'dot symlinks update'

* Some changes in templating::replace_var

* Fixed dot::get_script_src_path wrong call to SCRIPT_LOADED_LIBS. Also changed the way the variable is initialized

* Changed how check if a value exists in an array

* Fixed that init script were not initilizing

* Moved init dis/enable scripts
Some fixes in library
Some changes in dotly-init.sh

* Fixed dot self migration

* Changed the usage of output::clarification to output::write

* Deleted output::clarification

* Added better check if is installed or not a package

* Fixed missing old way to install package

* Fixed error message when enabled init-script does not exists

* output::question output::question_default output::yesno Change them could broke many scripts

* Moved package functions out of add script

* Fixed enable when select multiple script to enable

* Fixed path error for zsh brew autocompletions

* Fix update when no update yaml file is given and no choose in fzf selection

* Changed the name of dot::get_script_src_path to dot::load_library.

* Fixed NUL character ocurred in the input

* Fixed copy&paste error

* Update comment

* Added dynamic recipes

* Added custom package recipes by user

Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
Co-authored-by: Henry Palacios <henrydpalacios@gmail.com>
Co-authored-by: Javier Ferrer <javier.mailserio@gmail.com>
Co-authored-by: Rafa Gómez <rgomezcasas@gmail.com>
Co-authored-by: David Asensio Cañas <david.asensio@icloud.com>
Co-authored-by: David Asensio Cañas <david.asensio@lifullconnect.com>
Co-authored-by: Daniel Santamaría <santaka87@gmail.com>
* Paths are now loaded before everything

* Core update, adding some functions that will be used with other features/fixes in other PRs. Added feature of autoupdate dotly

* Improved output::join with a stackoverflow function in: https://stackoverflow.com/a/17841619
Removed duplicate functions

* Added closed and unapproved PR #61 because it is needed when I use beta branch for testing and developing.

* Added a way to modify DOTFILES_PATH structure when add a feature to dotly, fixed all the way init-scripts were loaded because they fail. Fixed some issues.

* Added some core functions:
* Added new functions to get the current script_name or script_path where the functions were run
* Added function to conver mayus to lower

* Fix git pretty-log when commit is a branch (#100)

* 🍎 Install `mas` even on Apple Silicon (arm64) (#102)

`mas` has added support for Apple Silicon: mas-cli/mas#310

* Trigger `dot` command using `ctr+f`

* Use Volta instead of NPM to dump global packages in case it is installed (#107)

Co-authored-by: David Asensio Cañas <david.asensio@lifullconnect.com>

* [📦 rust] Fix crash while updating cargo dependencies (#113)

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
```

* [🐍 python] Avoid crash in case of not having python dependencies (#111)

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 async library
Added script 'dot symlinks update'

* Enable/disable autoload scripts can be symlinks

* Fixed error #93 with bash autocompletions

* Autoupdate

* Added folder for use with script 'dot symlinks update'
* Fix errors with symlinks update script when files are symbolic links
* Fix non alphanumeric names of files

* Added warning when no GITHUB_TOKEN is set

* Repetitive stuff should be in a loop

* Added support in update symlinks for symlinks, so now scripts and updates can apply its own symlinks without adding files in symlinks subfolder

* Support for symlinks and files as init scripts, so now scripts can also use it without copying files to the init-scripts folder
Added a CHANGELOG

* Added a new subcommand for script 'dot shell zsh': 'fix_permissions'
* When you have problems of file permissions of autocompletions or any zsh file
  you can solve those errors by executing this subcommand.

* Added a way to deactivate init scripts

* Use {▪} icon for prompt error status (#128)

Merged official dotly master branch in this branch.

* Removed unneded variable

* Fixed unbound variables

* Solved end / in url makes api call fail

* Add feature to import/export multiple machine configurations

Import/Export by hostname or any other given name:
- Package manager, installed packages
- Mac defaults

* Fix some minor variable declarations

* Formatting issues

* Added all features for this branch
- Added core functions in output.sh: output::question_default, output::yesno
- Fixed in core functions output.sh: output::question. This was adding a new line to the prompt that creates confusion.
- Added export/import packages of package managers by given alias or hostname.
- Added export/import mac defaults by given alias or hostname.

* Not necessary lib

* Removed not needed variable

* Not needed file

* Renamed utils to src as PR #140

* Fixed to avoid unbound variable

* Changes in autoupdate
- Now github API is not needed for autoupdate
- Update minor right way but need tagged commits
- Update stable only to tagged versions
- Update to latest commit in master as always did

* Added 'dot self version' to choose your running DOTLY version

* Added more options to 'dot self version'

* Solved issues with libraries

* Feat/Fix migration and how libraries are loaded
- Moved functions from platform to dot
- Now added a function to load sandboxed libraries in context
- Migrate all scripts of this feature to use function to load sandboxed libraries
- Added migration script
- Renamed dotbot migration file
- Added option to no warn user about dotbot migration changes

* Added a way to try to guess if migration script is necessary

* Added migration script

* Fixed templating

* Fixed .zshrc file

* Updated init-dotly for zsh

* Updated init-dotly for bash

* Fix migration scripts
Final formating for dot self update

* Added gitignore to migration script, added dotbot migration yaml

* Added zsh test back

* Fixed to add automatically $HOME var when tamplating if path is inside your home

* Fixed zsh theme for autoupdate. Fix Format in .gitignore

* Fixed copy paste error for zsh DOTLY loading

* Fixed function name. It must be called autoupdate instead of update

* Modified to use the new way of load sandboxed libraries

* Added second optional param to dot::get_script_src_path
 - Now end .sh is optional but recommended
 - Now firstly it will try to load from Dotly core (for optional core libs)
 - Secondly it will try to load from directory 'src' in given path as second argument or current script path
 - Finally it will try to load from given path or inside the current script path

* Modified how libraries are loaded second step and later. Final work is:
1. Try to load from dotly core for not added in _main libraries (optionals)
2. Try to load from current script context 'src' subfolder
3. Try to load from a given context as second argument 'src' folder
4. If the second argument is not a context and library is not ther it will manage the second argument as a directory where the lib in the first argument should be.

* Check for variables or default value

* Deleted platform function from output.sh

* Improved the way errors are handled when exporting packages

* Removed not need of restore start working directory

* Fixed unbound variable

* Fixed dot::get_script_src_path lib loading

- Changed load priority. If second parameter is given it should be in the first place.
- Fixed loading libraries when not .sh was provided.
- Added `SCRIPT_LOADED_LIBS` variable to avoid duplicate loading of libs.

* Added default theme codely

* Fixed error when LOADED_LIBS does not have any library yet

* Fix(core): Dotfiles, core and variables
- Changed the way how dotly is loaded
- Removed dotfiles_template/shell/init.sh
- Changed JAVA_HOME
- Conditional add to PATH of `JAVA_HOME`, `GEM_HOME` and `GOHOME`
- Fixed core library `array.sh` were not loaded.
- Fixed in the `_main.sh` the alphabetical order were not preserved for `output.sh`
- Fixed functions that were required for dotly were in the user `functions.sh` instead in the core loading file. Now these functions are in `shell/init-dotly.sh` and `shell/zsh/init.sh`.
- Fixed not default theme were provided in bash.
- `dot::get_script_src_path` should be the recommended way to load a lib in any script. Maybe these functions should be directly available in `dot` command.
- Minor change in migration script to export current `PATH` directories

* Provided default values to all variables in output. Changed $1 for $* to accept all params in text functions

* Fix(import): Error importing packages

Solved an error when importing packages from a previous machine if the file name is similar but not exactly the same the import ocurred with a different name. For example if your brewfile (or any other) previous name was "this-is-my-computer-old" and the new name for your computer was "this-is-my-computer". The script were importing "this-is-my-computer-old".

* Added brew autocompletions for bash and zsh
Changed the way bash autocompletions are loaded
Some fixes in reverse-search internal variables
Added shellcheck ignores when needed in dotly loader
Added handle errors when loading files
Init scripts now with find which enable it to use non alphabetical path names
Moved to init-dotly.sh aliases.sh and functions.sh

* Added double quotes in _main for DOTLY_PATH because it can contain non alphabetical chars

* Improved output::join with a stackoverflow function in: https://stackoverflow.com/a/17841619
Removed duplicate functions

* Added closed and unapproved PR #61 because it is needed when I use beta branch for testing and developing.

* Added a way to modify DOTFILES_PATH structure when add a feature to dotly, fixed all the way init-scripts were loaded because they fail. Fixed some issues.

* Added some core functions:
* Added new functions to get the current script_name or script_path where the functions were run
* Added function to conver mayus to lower

* Added async library
Added script 'dot symlinks update'

* Some changes in templating::replace_var

* Fixed dot::get_script_src_path wrong call to SCRIPT_LOADED_LIBS. Also changed the way the variable is initialized

* Changed how check if a value exists in an array

* Fixed that init script were not initilizing

* Moved init dis/enable scripts
Some fixes in library
Some changes in dotly-init.sh

* Fixed dot self migration

* Changed the usage of output::clarification to output::write

* Deleted output::clarification

* Added better check if is installed or not a package

* Fixed missing old way to install package

* Fixed error message when enabled init-script does not exists

* output::question output::question_default output::yesno Change them could broke many scripts

* Moved package functions out of add script

* Fixed enable when select multiple script to enable

* Fixed path error for zsh brew autocompletions

* Modified to use output::write instead of output::clarification, modified ls to use find

* Added couple of kill to view the effecto of importing defaults

* Fixed not well included dump.sh library

* Fix update when no update yaml file is given and no choose in fzf selection

* Changed the name of dot::get_script_src_path to dot::load_library.

* Fixed NUL character ocurred in the input

* Fixed copy&paste error

* Update comment

* Added dynamic recipes

* Added custom package recipes by user

* Fixed how path is loaded in dotly initializer. Fixed BASH shell loading zsh in macOS

* Fix update when no update yaml file is given and no choose in fzf selection

* Changed the name of dot::get_script_src_path to dot::load_library.

* Changed the name of dot::get_script_src_path to dot::load_library.

* Fix: PATHS and BASH
- 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)

* Added GPG_TTY in init-dotly because it fails if I add it later

* Added open command

* Fixed no solved merge conflict

* Fix xargs issue without -0 option
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?

* The libs were not be added to SCRIPT_LOADED_LIBS

* [Feature] Cargo Export/Import multimachine (#13)

* Added cargo export/import

* Fix(dump.sh): Apply patch to fix wrong importing file
- Fixed wrong importing file when computer hostname was similar to another one
- Fixed errors in messages

* Restored dot and output from master to avoid merging problems

* Added double quotes in _main for DOTLY_PATH because it can contain non alphabetical chars

* Improved output::join with a stackoverflow function in: https://stackoverflow.com/a/17841619
Removed duplicate functions

* Added closed and unapproved PR #61 because it is needed when I use beta branch for testing and developing.

* Added a way to modify DOTFILES_PATH structure when add a feature to dotly, fixed all the way init-scripts were loaded because they fail. Fixed some issues.

* Added some core functions:
* Added new functions to get the current script_name or script_path where the functions were run
* Added function to conver mayus to lower

* Added async library
Added script 'dot symlinks update'

* Added couple of kill to view the effecto of importing defaults

* Fixed not well included dump.sh library

* Added couple of kill to view the effect of importing defaults

* Fixed not well included dump.sh library

* Fix update when no update yaml file is given and no choose in fzf selection

* Changed the name of dot::get_script_src_path to dot::load_library.

Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>

Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
Co-authored-by: Henry Palacios <henrydpalacios@gmail.com>
Co-authored-by: Javier Ferrer <javier.mailserio@gmail.com>
Co-authored-by: Rafa Gómez <rgomezcasas@gmail.com>
Co-authored-by: David Asensio Cañas <david.asensio@icloud.com>
Co-authored-by: David Asensio Cañas <david.asensio@lifullconnect.com>
Co-authored-by: Daniel Santamaría <santaka87@gmail.com>
Co-authored-by: Gabriel Trabanco Llano <gtrabanco@users.noreply.github.com>
@gtrabanco gtrabanco changed the title [Feature] Move files to inside your dotfiles [WIP] [Feature] Move files to inside your dotfiles Jun 25, 2021
@gtrabanco gtrabanco closed this Jun 25, 2021
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