oca-creations / ally Goto Github PK
View Code? Open in Web Editor NEWA powerful command-line tool for managing ZSH aliases, written in Swift.
License: MIT License
A powerful command-line tool for managing ZSH aliases, written in Swift.
License: MIT License
These were generated by AI (Bard's new image feature). Please give a ๐ or a ๐ below if you really like or do not like any of them.
Ally does not specifically prohibit the use of multi-line arguments when using add
or any other command. However, a multi-line command is not properly removed when using remove
, is not properly executed or encapsulated with quotes in .ally
, and causes an Index Out Of Range Error (which should probably be checked first) on list
. This is outputted as: Swift/ContiguousArrayBuffer.swift:600: Fatal error: Index out of range
, and occurs on these lines:
Ally/Sources/Helpers/DotFile.swift
Lines 64 to 73 in c943c24
[1]
) of parts
. To summarize, we must choose one of the following:
The details for these will be updated soon.
Describe the bug
macOS automatically adds binaries in /usr/bin
to PATH. Our install.sh
script moves our built ally binary to that location - thus, the first line of the ally file ends up being:
alias ally="ally"
We should either fix this alias (i.e. not add it) or add an option to not add it or install in a different location.
Output
alias ally="ally"
THIS IS EXPECTED BEHAVIOR. This is also desired, as if the user installs in a location not on PATH, then we want this alias. We could fix it:
FIX
One, allow the user to specify --no-alias
and also --overwrite
(the second one is unrelated to this issue, but still good-to-have) when installing. Specify this --no-alias
when calling ally init
(which we might want to change to ally setup
) from the script.
Describe the bug
When one runs ally remove
on an alias with documentation added on the lines above, these lines of documentation are not properly removed; instead, they remain and are then incorrectly interpreted as docs for other commands.
Output
First, create a sample .ally
file:
# This is example documentation
alias example="echo Hello, World\!"
alias testTwo="echo TestTwo"
Now, run ally remove
:
ally remove example
.Ally file has been resaved, and example is no longer available in the .ally file. To make these settings take effect for this terminal session, run
source ~/.ally
However, if one now executes ally list
or looks at the contents of the ~/.ally
file:
# This is example documentation
alias testTwo="echo TestTwo"
The alias is removed, but its docs were not.
To Reproduce
Steps to reproduce the behavior:
.ally
file.ally remove ALIAS_WITH_DOCUMENTATION
ally list
or cat ~/.ally
Expected behavior
The documentation should have been removed with the command when ally remove
was run, leaving no docs left for the removed command.
Is your feature request related to a problem? Please describe.
Somewhat. When Ally finishes a command, it will output:
To make these settings take effect for this terminal session,
And then cuts off. We ideally want to have ally reload the terminal automatically.
Describe the solution you'd like
The ally
command should be set into a zsh function, allowing source
to be run after normal command finishes. Otherwise, we can change it to outputting
source $HOME/.ally
Describe alternatives you've considered
A function or asking the user to run source
, but that requires further user action. Since it is ally
's goal to mimic the alias
command, we ideally want it to add it to the local session like alias
does.
Is your feature request related to a problem? Please describe.
Yes - somewhat. When running man ally
, we get the error:
No manual entry for ally
It's worth noting that this may come from ally not being in PATH, but instead being an alias. An issue for this discussion will be created soon.
Describe the solution you'd like
According to https://forums.swift.org/t/when-to-use-swiftpm-plugin-for-generating-man-pages/59010, we should be able to generate a man
page - maybe in a Build Step? Then, when running man ally
, we should see the following output:
... Autogenerated manpage here (see `man ls` for an idea).
Describe alternatives you've considered
ally help
and ally help SUBCOMMAND
, as well as the normal help variations, already provide useful info. We do need to improve the command docs (again, this will be in a soon-to-create issue), but this functionality is already somewhat available, just not with man
.
Is your feature request related to a problem? Please describe.
No. While there is an error produced when one uses an =
sign and doesn't follow command format, this is expected behavior.
Background
In the .ally file, and indeed in a .zshrc, an alias is declared with an =
sign. For example, to alias git commit -m
to gm
, the .ally file would say:
alias gm='git commit -m'
However, that's not how ally works, but it is how calling alias
from the command line works. So if you wanted to add this in ally, you would have to say: ally add gm 'git commit -m'
. However, if you try to add it with an equals:
> ally add gm='git commit -m'
Error: Missing expected argument '<command>'
Help: <command> The long-form command to be aliased to `alias`.
Usage: ally add [--no-reload] [--no-output] <alias> <command>
See 'ally add --help' for more information.
So, we need to support this equals syntax. The way to do this is to take the input to add
as one command, and then parse it based on whether it contains an equals sign.
Describe alternatives you've considered
None.
Improve file.
CommandConfiguration
run
functionscanAndRemoveIfNeeded
functionwhere
clauses are preferred over a single if
inside a for
(for_where)Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
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.