sebglazebrook / aliases Goto Github PK
View Code? Open in Web Editor NEWContextual, dynamic aliases for the bash shell
Contextual, dynamic aliases for the bash shell
The cli command descriptions only allow 1 line of text
Using man pages will allow us to describe the commands in more detail and provide clear examples of how you can use the commands in different situations.
OS: Ubuntu 20.04.1 LTS on Windows 10 x86_64
I am getting this error while initiating
❯ aliases init
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "No such file or directory" } }', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:845
note: Run with `RUST_BACKTRACE=1` for a backtrace.
any chance for rhel, centos, and fedora support?
if not, any chance on build instructions
Hello,
I have been using aliases for a few weeks now, but recently noticed an error when I reload my shell:
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: MissingFieldError("users")', ../src/libcore/result.rs:746
note: Run with `RUST_BACKTRACE=1` for a backtrace.
When attempting to use aliases
in my project directory I receive the same error as above, and any aliases set with the .alias
file returns the error -bash: archive: command not found
Here is my alias file for reference:
archive:
command: . archive-project.sh
backout_seconds: 3
new:
command: . new-project.sh
backout_seconds: 3
And I am on OSX 10.10.5
Please let me know if you need any additional information from me. Thanks!
Hi, after installing the deb file in the repository, I created a simple .aliases file in a directory. I could see the alias by running aliases
and aliases list
but it did not seem like the alias was actually loaded into the environment even after running aliases rehash
. I can run the command by typing aliases exec . "cmd"
but this is inconvenient and not the default behavior, I assume. Is there anything I'm missing or need to run in order to fix this and get default behavior?
If you run aliases rehash
and a new alias isn't created it's hard to see why.
Maybe we could add a --debug
or --trace
or something so you can see exactly what's happening.
To reproduce:
cd /tmp
mkdir original
ln -s original linked
cd linked
aliases init
cat ~/.aliases_cfg | grep linked
they only work in the home directory not globally.
mkdir tmp && cd tmp && aliases init && aliases
throws:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', ../src/libcollections/vec.rs:1265
note: Run with `RUST_BACKTRACE=1` for a backtrace.
https://gist.github.com/guilherme/794f01eba10075e72db3cfd841fb8e6b
when I try to remove an alias that doesn't exist via the cli I get no feedback that it doesn't exist.
The exit code is 0 and there is no message to stderr.
Installation of deb
package fails with this method;
sudo dpkg -i aliases_0.8.1.deb
Output as below:
dpkg-deb: error: 'aliases_0.8.1.deb' is not a debian format archive
dpkg: error processing archive aliases_0.8.1.deb (--install):
subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
aliases_0.8.1.deb
Running brew install sebglazebrook/aliases/aliases
results in the following warning:
Warning: Calling <<-EOS.undent is deprecated!
Use <<~EOS instead.
/usr/local/Homebrew/Library/Taps/sebglazebrook/homebrew-aliases/aliases.rb:21:in `caveats'
Please report this to the sebglazebrook/aliases tap!
Thought you might like to know.
To replicate:
mkdir /tmp/test-dir
cd /tmp/test-dir
aliases init --user foo
# now add an alias in the .aliases-foo file with the name 'bar' command: "hello from /tmp/test-dir"
cd ~
# now add an alias in the .aliases file named 'bar' command: "hello from home"
aliases rehash
cd /tmp/test-dir
aliases list --directory ${PWD}
=> returns nothing
bar
=> "hello from home"
Currently to achieve nested aliases we have to embed entire case switch statement inside the .aliases file that pick up the aliasing parts. Might be awesome to be able to create nested aliases? Would allow us to create very advanced aliases.
As a User
I want to know when I am adding an alias that is already defined
So that I don't add one on top of the other
The other frame from this is:
As a User
I want to have the ability to overwrite aliases
So that I can refine one alias that was defined before (made a mistake typing, or want to improve the command)
It just doesn't create it.
Logging or error message would be good.
Hi,
Trying to add some simple aliases with your plugin.
$cd ~ && aliases init
$vim .aliases
la:
command: ls -la
to .aliases file
4. $aliases rehash
5. $la
Getting: -bash: alias: la: not found
Only way I could execute the alias is with $aliases exec . la
Am I doing something wrong or?
I'm getting this error when I do: aliases remove with an alias that was previously defined in the ~/.aliases.
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcollections/vec.rs:1392
note: Run with `RUST_BACKTRACE=1` for a backtrace.
I'll work on this PR soon
Currently you can add dynamically an alias. It would be nice to remove it dynamically as well.
As a User
I want to remove an aliases dynamically
So I don't have to edit the file, having the risk of making a typo and also having a quicker feedback.
to replicate:
foo:
command: echo "bar"
conditional: [ "$(echo 'hello')" = 'hello' ]
This project has been inactive since Dec 2018. Is this project still alive?
aliases remove
Currently aliases remove
only takes an alias name.
As a user
I want to be able to remove user aliases or directory specific aliases via the cli
So I don't have to manually edit the .aliases file
# remove for a user
aliases remove --user superman fly
# remove for a directory, this does not allow a --local option
aliases remove --directory ~/code/superman fly
# remove for local directory, this does not allow a --directory option
aliases remove --local fly
# remove for directory and user, this does not allow a --local option
aliases remove --directory ~/code/superman --user superman fly
# remove for local dir and user, this does not allow a --directory option
aliases remove --local --user superman fly
I truly hope I understand this tool
So I run "aliases rehash" and get a '0' return code and no output
I assume my aliases should be available bu when I try to run them I get nothing. the only way they run
is with the aliases exec . command
what am i missing here?
When I try to clone repo it blows up saying "user not found"
It looks like the code first checks to see if the user exists and if not found it blows up.
It should be able to clone a repo for a user that doesn't exist and then simply create the user afterwards
So this is just documenting mu thought process around this.
Given you can clone a user and it automatically looks for user's in github.com/username/dot-aliases
Example command/usage"
aliases search git commit introduced string
This under the covers makes an external request to an aliases search server which caches all known external aliases and returns results that match the query string.
When a user aliases clone
successfully a ping is sent to the aliases search server to index that user.
It uses all the current data about an alias but we also add a description
field to allow for free text.
Hey there, this looks like such a cool project and I'd like to check it out. However, the Compile from Source section hasn't been deplaceholdered yet, and I'm not sure I can figure out how to run a ruby project on my own... Any chance you could give us some instructions in the near future?
Great Work! (I think)
P.S. I'm on Arch Linux
~.aliases
gp:
command: git push
confirm: true
aliases rehash
RUST_BACKTRACE=1 aliases rehash
thread '<unnamed>' panicked at 'failed to execute child: Too many open files (os error 24)', src/aliases/factories/mod.rs:34
stack backtrace:
1: 0x10758b26a - std::sys::backtrace::tracing::imp::write::h4b09e6e8c01db097
2: 0x10759069f - std::panicking::default_hook::{{closure}}::h1d3243f546573ff4
3: 0x10758f645 - std::panicking::default_hook::h96c288d728df3ebf
4: 0x10758fc56 - std::panicking::rust_panic_with_hook::hb1322e5f2588b4db
5: 0x10758faf4 - std::panicking::begin_panic::hfbeda5aad583dc32
6: 0x10758fa12 - std::panicking::begin_panic_fmt::h4fe9fb9d5109c4bf
7: 0x1075080c5 - aliases::aliases::factories::ShimFileFactory::create::h74ee660c32ba5fe8
8: 0x1074f8dd9 - <F as crossbeam::FnBox>::call_box::h1327d96983356799
9: 0x107590c5a - __rust_maybe_catch_panic
10: 0x1074fb9a5 - <F as alloc::boxed::FnBox<A>>::call_box::h5e692c65c59383ce
11: 0x10758eeb4 - std::sys::thread::Thread::new::thread_start::h022e3887023c6290
12: 0x7fffa822faaa - _pthread_body
13: 0x7fffa822f9f6 - _pthread_start
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any', ../src/libcore/result.rs:799
stack backtrace:
1: 0x10758b26a - std::sys::backtrace::tracing::imp::write::h4b09e6e8c01db097
2: 0x10759069f - std::panicking::default_hook::{{closure}}::h1d3243f546573ff4
3: 0x10758f645 - std::panicking::default_hook::h96c288d728df3ebf
4: 0x10758fc56 - std::panicking::rust_panic_with_hook::hb1322e5f2588b4db
5: 0x10758faf4 - std::panicking::begin_panic::hfbeda5aad583dc32
6: 0x10758fa12 - std::panicking::begin_panic_fmt::h4fe9fb9d5109c4bf
7: 0x10758f977 - rust_begin_unwind
8: 0x1075baf70 - core::panicking::panic_fmt::h4395919ece15c671
9: 0x10750f5a1 - core::result::unwrap_failed::h826d1e65f62f2c7c
10: 0x10750f952 - crossbeam::scoped::JoinState::join::h9e38daeeb9d6bd47
11: 0x1074f8eab - <F as crossbeam::FnBox>::call_box::ha25b0713f0de7f23
12: 0x10750faee - crossbeam::scoped::Scope::drop_all::h3e0a95c5837743d3
13: 0x107501cf1 - aliases::aliases::commands::rehash::Rehash::execute::ha7c83d1afa68516c
14: 0x10750cc93 - aliases::aliases::app::App::execute_rehash::h4d407e2fc58f2818
15: 0x10748f6f5 - aliases::main::h09ef9aae42dcce6b
16: 0x107590c5a - __rust_maybe_catch_panic
17: 0x10758f186 - std::rt::lang_start::haaae1186de9de8cb
Depending on how you use aliases things can get quite abstracted.
You can nest aliases, use positional parameters, pass through arguments etc.
An interactive mode would help to break down aliases into each of their steps, with confirmation at each step.
E.g.
Imagine I have an alias:
console
console maps to:
build-container && run-container bundle exec rails console
build-container maps to:
docker build -t my-image .
run-container maps to:
docker run -ti -v ${PWD}:/code my-image
If I want to understand the magic behind the console
curtain a user could set:
export ALIASES_INTERACTIVE=true
and then when they run console
at each step, before execution the user sees the current stdout and stderr and the proposed command and gets to choose whether they want to continue or not.
This proposed command will include any positional params or arguments included, so basically if the user copied it and run it in another shell it would work.
I'm on Mac OS Monterey
GNU bash, version 5.1.12(1)-release (x86_64-apple-darwin19.6.0)
$ aliases
ALIAS COMMAND CONFIRM
build npm run build false
debug grc tail -f ../../debug.log false
dev npm run dev false
$ dev
bash: dev: command does not exist
Clearly, aliases is installed and working properly, until I actually wanna execute an alias.
I've been scratching my head for the better part of an hour trying to figure this out and I can't make sense of it. It works just fine on my laptop - also a Mac running Monterey.
Anyone else have this issue?
Hi. I was just trying out aliases and this happened
aliases init
-bash: /usr/local/bin/aliases: Permission denied
ls -l /usr/local/Cellar/aliases/0.8.1/bin/aliases
-r--r--r-- 1 matthewpanetta admin 5748912 Feb 1 21:23 /usr/local/Cellar/aliases/0.8.1/bin/aliases
be rake foo:bar[superman,batman]
Executing: bundle exec foo:bar[superman batman]
If you are in directory /foo and /foo hasn't been initialized yet so it's not in ~/.aliases_cfg then aliases will still list the aliases like they are available but they are not.
If I have an alias g
that completes to 'git' I don't see the git bash completion
Dynamically work out the command being entered and direct the bash completion to the right command
If the working dir is ~/code/my-cool-app
and I have a .aliases
file there but I'm in the ./test
dir I want to be able to use the aliases in the parent dir.
Similar to git, if the current dir isn't git initialized it will go up the dir tree until it finds one
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.