Git Product home page Git Product logo

homebrew-aliases's Introduction

Homebrew Aliases

This tap allows you to alias your Homebrew commands.

Install

brew tap homebrew/aliases

Usage

This works similar to the alias command:

# add aliases
$ brew alias up='update'
$ brew alias i='install'

# print all aliases
$ brew alias

# print one alias
$ brew alias up

# use your aliases like any other command
$ brew i git

# remove an alias
$ brew unalias i

Note: Some commands are reserved and can’t be aliased (Homebrew core commands as well as alias and unalias).

Additional Features

All aliases are prefixed with brew, unless they start with ! or %:

# 'brew up' -> 'brew update'
$ brew alias up=update

# 'brew status' -> 'git status'
$ brew alias status='!git status'

Note: You may need single-quotes to prevent your shell from interpreting !, but % will work for both types.

# Use shell expansion to preserve a local variable
# 'brew git status' -> '/path/to/my/git status'
$ mygit=/path/to/my/git
$ brew alias git="% $mygit"

Aliases can include other aliases:

$ brew alias show=info
$ brew alias print=show
$ brew print git # will run 'brew info git'

Aliases can be opened in $EDITOR with the --edit flag.

# Edit alias 'brew foo'
$ brew alias foo --edit
# Assign and edit alias 'brew foo'
$ brew alias foo=bar --edit

# This works too
$ brew alias --edit foo
$ brew alias --edit foo=bar

# Open all aliases in EDITOR
$ brew alias --edit

Note: If the named alias doesn't exist it will be created.

homebrew-aliases's People

Contributors

bfontaine avatar bo98 avatar branchvincent avatar brewtestbot avatar dduugg avatar issyl0 avatar kabel avatar leonklingele avatar lylemoffitt avatar mikemcquaid avatar nandahkrishna avatar reitermarkus avatar rylan12 avatar texastoland avatar wavinflag avatar xu-cheng avatar yumitsu 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebrew-aliases's Issues

`brew commands` outputs `alias` command twice.

That's what I get when running brew commands after latest updates.
Screen Shot 2020-03-02 at 09 02 15

Also, brew tap-info tells:

λ brew tap-info homebrew/aliases
homebrew/aliases: unpinned, 3 commands                     <------------ 3 commands?
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-aliases (194 files, 125.6KB)
From: https://github.com/Homebrew/homebrew-aliases

unalias and edit throw unreasonable errors

unalias always says the alias doesn't exist.
alias --edit always says the alias already exists (which is true, but shouldn't be an error).

$ brew alias
brew alias overwrite='info %'
brew alias i='install'
$ brew unalias overwrite
Error: 'brew overwrite' is not aliased to anything.
$ brew alias --edit overwrite
Error: 'brew overwrite' already exists. Sorry.
$ brew unalias i
Error: 'brew i' is not aliased to anything.

Prefix "!" produces error

Tried to create a simple alias with the "!" prefix, like so:

bash-4.4$ brew alias toast="!echo I like toast"
bash: !echo: event not found

The standard usage seems to work though.

Save in XDG_CONFIG_HOME

I understand the backwards compatibility issue. It'd be nice to at least be able to configure the directory. Generally I'd expect it in .config/brew-aliases.

Error in unalias

I just followed the readme:

❯ brew alias status='!git status'
❯ brew alias status              
brew alias status='!git status'
❯ brew unalias status       
Error: undefined method `named' for ["status"]:Array
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-aliases/cmd/unalias.rb:22:in `unalias'
/usr/local/Homebrew/Library/Homebrew/brew.rb:110:in `<main>'

Aliases are not saved into XDG_CONFIG_HOME

...as line 9 always fails.

BASE_DIR = begin
Pathname.new("~/.config/brew-aliases").realpath
rescue
Pathname.new("~/.brew-aliases").expand_path
end.freeze

Changing it to

    Pathname.new("~/.config/brew-aliases").expand_path

should fix it, but then the latter condition ("~/.brew-aliases") is never reached.

brew alias reports deprecated call

General troubleshooting steps

Description of issue

brew tap "homebrew/aliases"
brew alias all='update;brew upgrade;brew cask upgrade;brew cleanup;brew cask cleanup;brew doctor'

Command works as expected, creating the appropriate alias, with no functional issue. But, the command returns the following:

Warning: Calling <<-EOS.undent is deprecated!
Use <<~EOS instead.
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-aliases/cmd/brew-alias.rb:75:in `write'
Please report this to the homebrew/aliases tap!

Warning: Calling <<-EOS.undent is deprecated!
Use <<~EOS instead.
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-aliases/cmd/brew-alias.rb:95:in `block in write'
Please report this to the homebrew/aliases tap!

Output of your command with --verbose --debug

/usr/local/Homebrew/Library/Homebrew/brew.rb:107:in `exit'
/usr/local/Homebrew/Library/Homebrew/brew.rb:107:in `<main>'

Output of brew cask doctor

Your system is ready to brew.

--help doesn’t work on aliases

$ brew install --help
brew install [--debug] [--env=std|super] [--ignore-dependencies] [--only-dependencies] [--cc=compiler] [--build-from-source] [--devel|--HEAD] [--keep-tmp] formula:
    Install formula.
[…]

$ brew alias yolo=install
$ brew yolo --help
Warning: No help text in: /usr/local/bin/brew-yolo
Example usage:
  brew search [TEXT|/REGEX/]
  brew (info|home|options) [FORMULA...]
[…]

Weird output on certain aliases

Running brew alias -anything="12d" gives traceback of

/usr/local/Library/brew.rb:101:in `exit'
/usr/local/Library/brew.rb:101:in `<main>'

The alias still works, and the exit code is 0. From testing, it looks like it needs the alias to start with -, and the third character in the command needs to be a d. I have no clue why this happens...

(I found this by running brew alias -Syu="update && brew info")

Aliases aren't found

I have a fresh install of homebrew and homebrew-aliases on macos catalina and none of the aliases I created take effect.

$ brew --version

Homebrew 3.0.5-62-gacfe9d2
Homebrew/homebrew-core (git revision ee7e17270e; last commit 2021-03-15)
Homebrew/homebrew-cask (git revision 86545bc466; last commit 2021-03-15)

$ brew tap --debug --verbose

adoptopenjdk/openjdk
aws/tap
chrokh/tap
colindean/fonts-nonfree
homebrew/aliases
homebrew/cask
homebrew/cask-fonts
homebrew/cask-versions
homebrew/command-not-found
homebrew/core
jmespath/jmespath
minio/stable
paulfitz/data
rbenv/tap
saulpw/vd
srkomodo/tap
universal-ctags/universal-ctags

$ brew alias

brew alias upg='upgrade'
brew alias ci='cask install'
brew alias i='install'
brew alias old='outdated'
brew alias cold='outdated --cask'
brew alias cupg='cask upgrade'

$ brew old

Error: Unknown command: old

$ type -a brew

brew is /usr/local/bin/brew
brew is /usr/local/bin/brew

$ which brew

/usr/local/bin/brew

$ echo $SHELL

/usr/local/bin/fish

$ ls ~/.brew-aliases

ci cold cupg i old upg

I am not sure what the issue is, but if there is any more information I can provide to help diagnose the issue please reach out.

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.