Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a command to exact search through your aliases #42

Open
mohitkyadav opened this issue May 12, 2022 · 0 comments
Open

Add a command to exact search through your aliases #42

mohitkyadav opened this issue May 12, 2022 · 0 comments
Assignees

Comments

@mohitkyadav
Copy link
Collaborator

@aashutoshrathi following func is what I use, but as you can see it only reads the .zshrc file. We can check for the shell and determine where to look. I was also 馃 if it's possible to check the self file name? If so same function could be used in any number of rc files.

cmdmatch () {
  # --help
  if [[ $1 == '--help' ]]; then
    echo "Usage: cmdmatch <pattern>";
    return 0;
  fi

  # Return matching aliases
  grep "alias" ~/.zshrc | grep "$1";

  # error if no arguments
  if [ $# -eq 0 ]; then
    echo "No arguments supplied"
    return 1
  fi
}
@mohitkyadav mohitkyadav self-assigned this May 12, 2022
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

No branches or pull requests

1 participant