diff options
| author | Lucas Santos <[email protected]> | 2022-03-02 15:57:14 +0100 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-02 15:57:14 +0100 | 
| commit | 5fd8b4b72642ab94c33bb6e706617a554c0d2f19 (patch) | |
| tree | cab34a65d495e9b28b24b4d9360568e94e6e19df | |
| parent | c12338393ef70b338724244de1dad88538f8a36a (diff) | |
feat: add option to automatically answer 'yes' for sh install script (#2306)
| -rw-r--r-- | README.md | 14 | ||||
| -rwxr-xr-x | utils/installer/install.sh | 41 | 
2 files changed, 36 insertions, 19 deletions
| @@ -28,12 +28,18 @@ You can find all the documentation for LunarVim at [lunarvim.org](https://www.lu  Make sure you have the release version of Neovim (0.6.1+). -Linux: +### Linux: +  ```bash  bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)  ``` -Windows (Powershell): +To run the install script without any interaction you can pass the `-y` flag to automatically install all dependencies and have no prompts. This is particularly useful in automated installations. + +The same way, you can use `--no-install-dependencies` to skip the dependency installation. + +### Windows (Powershell): +  ```powershell  Invoke-WebRequest https://raw.githubusercontent.com/LunarVim/LunarVim/master/utils/installer/install.ps1 -UseBasicParsing | Invoke-Expression  ``` @@ -159,7 +165,7 @@ lvim.plugins = {  > - @mvllow, Potential LunarVim user.  <div align="center" id="madewithlua"> -	 +  [](#madewithlua) -	 +  </div> diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 13679367..803b94dd 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -25,6 +25,7 @@ readonly BASEDIR  declare ARGS_LOCAL=0  declare ARGS_OVERWRITE=0  declare ARGS_INSTALL_DEPENDENCIES=1 +declare INTERACTIVE_MODE=1  declare -a __lvim_dirs=(    "$LUNARVIM_CONFIG_DIR" @@ -45,10 +46,11 @@ function usage() {    echo "Usage: install.sh [<options>]"    echo ""    echo "Options:" -  echo "    -h, --help                       Print this help message" -  echo "    -l, --local                      Install local copy of LunarVim" -  echo "    --overwrite                      Overwrite previous LunarVim configuration (a backup is always performed first)" -  echo "    --[no]-install-dependencies      Whether to prompt to install external dependencies (will prompt by default)" +  echo "    -h, --help                               Print this help message" +  echo "    -l, --local                              Install local copy of LunarVim" +  echo "    -y, --yes                                Disable confirmation prompts (answer yes to all questions)" +  echo "    --overwrite                              Overwrite previous LunarVim configuration (a backup is always performed first)" +  echo "    --[no]-install-dependencies              Whether to automatically install external dependencies (will prompt by default)"  }  function parse_arguments() { @@ -60,6 +62,9 @@ function parse_arguments() {        --overwrite)          ARGS_OVERWRITE=1          ;; +      -y | --yes) +        INTERACTIVE_MODE=0 +        ;;        --install-dependencies)          ARGS_INSTALL_DEPENDENCIES=1          ;; @@ -93,17 +98,23 @@ function main() {    check_system_deps    if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then -    msg "Would you like to install LunarVim's NodeJS dependencies?" -    read -p "[y]es or [n]o (default: no) : " -r answer -    [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps - -    msg "Would you like to install LunarVim's Python dependencies?" -    read -p "[y]es or [n]o (default: no) : " -r answer -    [ "$answer" != "${answer#[Yy]}" ] && install_python_deps - -    msg "Would you like to install LunarVim's Rust dependencies?" -    read -p "[y]es or [n]o (default: no) : " -r answer -    [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps +    if [ "$INTERACTIVE_MODE" -eq 1 ]; then +      msg "Would you like to install LunarVim's NodeJS dependencies?" +      read -p "[y]es or [n]o (default: no) : " -r answer +      [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps + +      msg "Would you like to install LunarVim's Python dependencies?" +      read -p "[y]es or [n]o (default: no) : " -r answer +      [ "$answer" != "${answer#[Yy]}" ] && install_python_deps + +      msg "Would you like to install LunarVim's Rust dependencies?" +      read -p "[y]es or [n]o (default: no) : " -r answer +      [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps +    else +      install_nodejs_deps +      install_python_deps +      install_rust_deps +    fi    fi    backup_old_config | 
