Code Monkey home page Code Monkey logo

ally's People

Contributors

mrdevel0per avatar

Stargazers

 avatar  avatar

ally's Issues

[GitHub] Toward a new logo

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.

[BUG] Ally is unable to handle multi-line commands

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:

//It's an alias!
print(currentLine)
let parts = currentLine.split(separator: "=").map { sub in
String(sub)
}
var firstPart = parts[0]
let firstPartFifthIndex = firstPart.index(firstPart.startIndex, offsetBy: 5)
firstPart = String(firstPart[firstPartFifthIndex...])
firstPart = firstPart.replacingOccurrences(of: "alias ", with: "").trimmingCharacters(in: .whitespacesAndNewlines)
let secondPart = parts[1]

More specifically, on line 73, where we get the second index ([1]) of parts. To summarize, we must choose one of the following:

Option One: Prohibit multiline arguments

Option Two: Handle Multiline Arguments

The details for these will be updated soon.

[BUG] Fix install script alias

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.

[BUG] Docs are not removed correctly

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:

  1. Add commands with docs to .ally file.
  2. Execute ally remove ALIAS_WITH_DOCUMENTATION
  3. Run ally list or cat ~/.ally
  4. See that docs for removed command still remain, and are incorrectly attributed to other commands.

Expected behavior
The documentation should have been removed with the command when ally remove was run, leaving no docs left for the removed command.

[FEATURE REQUEST] Create a function, allowing direct terminal reload (a.k.a `ally reload`)

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.

[FEATURE REQUEST] Impliment `man`

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.

[FEATURE REQUEST] Allow using `=` in the `add` command

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.

Solution

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.

Support Equals Signs!

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.

[Remove.swift]

Improve file.

TODOs

  • Improve docs for options
  • Improve bold printing
  • Improve CommandConfiguration
  • Document run function
  • Rewrite, secularize, and improve the scanAndRemoveIfNeeded function
  • Fix Prefer For-Where Violation: where clauses are preferred over a single if inside a for (for_where)
  • Document function

[FEATURE REQUEST] Improve dotfile parsing

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.

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.