aliases.sh - Bash utilities

A couple of bash functions to ease the pain of the day to day work paste them in your aliases file .

9

Votes

# Some short aliases for Lando commands and utilities.
ld() {
  if [[ $1 == "apps" ]]; then
    if [[ $2 == "-a" ]]; then
      command lando list -a | grep "app:" | sort -u
    elif [[ -z $2 ]]; then
      command lando list | grep "app:" | sort -u
    fi
  elif [[ $1 == "sh" ]]; then
    command lando drush ${@:2:$#}
  elif [[ $1 == "dru" ]]; then
    command lando drupal ${@:2:$#}
  elif [[ $1 == "comp" ]]; then
    command lando composer ${@:2:$#}
  elif [[ $@ == "--my-args" ]]; then
    printf 'Available local Lando shortcut and arguments:\n' &&\
    printf 'ld                    Shortcut for "lando ".\n' &&\
    printf 'ld apps               List running apps.\n' &&\
    printf 'ld apps -a            List all apps, even those not running.\n' &&\
    printf 'ld sh                 Shortcut for "lando drush"\n' &&\
    printf 'ld dru                Shortcut for "lando drupal"\n' &&\
    printf 'ld comp               Shortcut for "lando composer"\n' &&\
  else
    command lando "$@"
  fi
}

# Remove diacritics from filenames and replaces them by dashes.
function rm-diacritics {
  if [[ ! -z $1 ]]
  then
    mv $1 $(echo $1 | sed -e 's/[^A-Za-z0-9._-]/-/g')
  else
    echo "Please try again indicating the file you want to cleanup"
  fi
}

Vote Here

You must earn at least 1 vote on your snippets to be allowed to vote

Terms Of Use

Privacy Policy

Featured snippets are MIT license

Gears & Masters

Advertise

DevOpsnipp.com © 2020

medium.png