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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: User-defined Aliases, Abbreviations, Functions and Commands #12

Closed
dundalek opened this issue Nov 3, 2017 · 5 comments
Closed
Labels

Comments

@dundalek
Copy link
Owner

dundalek commented Nov 3, 2017

For user defined helpers I am thinking of supporting following:

Aliases

Aliases for defining / overriding functionality. When alias is used it does not get expanded and is saved into history as is.

Example:

(defalias ls "ls --color=auto")

Abbreviations

Abbreviations are similar to aliases but expand to underlying definition. Therefore autocomplete can work seamlessly and also full command is saved to history. Inspired by abbr in fish. See also discussion.

(defabbrev ga "git add")
(defabbr gaa "git add --all")

Functions

Classic Clojure functions, already works.

(defn hello [name]
  (str "Hello " name))

Run in command line like: (hello "World").

Commands

Similar to functions, but can be executed like commands without parens. Related to builtin commands. Defining similar to defn:

(defcmd hello [name]
  (str "Hello " name))

Run in command line like: hello World. There should probably also be a way to promote existing function to a command.

@4mitch
Copy link

4mitch commented Nov 3, 2017

Will it work like init.el in Emacs?

@dundalek
Copy link
Owner Author

dundalek commented Nov 5, 2017

@4mitch Currently we load ~/.closhrc on startup so users will be able to put these kinds of definitions there. So you could say it is similar to Emacs init (from my limited understanding of Emacs).

@mnewt
Copy link
Contributor

mnewt commented Feb 11, 2018

@dundalek Have you started on this yet? If not, I can tackle it

@dundalek
Copy link
Owner Author

I do work on it, I have an work in progress branch here: https://github.com/dundalek/closh/tree/feature/custom-commands-aliases

@dundalek
Copy link
Owner Author

This is now ready in master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants