catears / goto Goto Github PK
View Code? Open in Web Editor NEWGoto - The Good Way to Program
License: MIT License
Goto - The Good Way to Program
License: MIT License
Powershell has dynamic tab completion for commands which can be used https://adamtheautomator.com/powershell-tab-completion/
Assuming I have ~/Documents
and the teleport home:~
then goto hom/Diocuemants
should take me there. Perhaps hide it behind some configuration?
For example
$ goto --config set AllowFuzzyMatch True
$ goto --config set AllowFuzzySubdirectoryTraversal True
$ goto --config set FuzzinessLevel 5 # Allow hamming distance/text difference of 5 characters
When running goto with a small set of teleports (3) and just running goto --get
I got the following timing for 10'000 invocations (which felt like it was slow to me?)
This is the script
#!/bin/bash
#EXEC="goto-cd"
EXEC=".local/bin/_gotohelper"
for i in {1..10000}
do
$EXEC --get home >> /dev/null
done
Currently running python, gonna see what time it takes...
Found a lot of "@" interjected everywhere in my profile when creating it. ASCII vs. EU-encoding vs. UTF8?
This should be straightforward by changing the goto-bash.sh file and goto-zsh.sh file but can also be achieved similar to https://brbsix.github.io/2015/11/23/perform-tab-completion-for-aliases-in-bash/
This could be entirely possible using Invoke-Expression
http://click.palletsprojects.com/en/7.x/bashcomplete/
Seems to support both bash and zsh...
The python version of goto
included completions for sub-directories. The algorithm for this is simple, when goto --prefix
has a teleport with a '/' appended, then we are looking for sub-directories.
When a folder has spaces in it, like "My Documents"
, tabbing in bash will get both "A/B/C/My" and "Documents" as possible completions.
Instead it prints the help message. This has to do with python2 making the string you get from click a unicode
and not a str
.
For example goto --add home:~
(this is of course a contrived example...)
So far you cannot actually change any behavior in goto
but I would like to extend goto
in the future to include behavior for coming features. To do this I want to introduce goto --config
. It should be a simple key/value store where keys can be stored and then retrieved, both by the user to inspect the current configuration, but also the program itself.
My idea is that keys should be whitelisted and verified on input and then be stored in _setting.toml
which is already used by the program to keep track of current profile and stuff like that.
Below is a simple example of how I think it should work:
$ goto --config set example_key 1234
example_key set to 1234
$ goto --config get example_key
1234
$ goto --config set invalid_example_key 1234
Error: "invalid_example_key" is an invalid key for the config
$ goto --config remove example_key
example_key removed from config
$ goto --config get example_key
Error: example_key is not set
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.