Comments (4)
The main reason for why you need start_goto sourced is to be able to run goto cd <magicword>
and then have the terminal change working directory - as you would expect. The other reason is to setup auto completion for goto. (this must be done each time a terminal starts, as far as I know).
In order to change the working directory of the parent shell, i.e, your terminal, running a script simply will not work. It changes the working directory of the forked process, but not the shell you are in. Sourcing runs the script as it would if you typed the commands one by one - and so this is ultimately how goto circumvents this issue of being able to change working directory of the shell calling goto.
However, we discussed this - should the setup script touch your ~/.bash_profile without warning?
The thought behind it doing that was to make setup a no-hazzle time and make goto work straight away. However it assumed every system would have a .bash_profile and that was the main entrypoint. It is a naïve assumption.
I think the best solution could be to ask the user when goto installs. To give a prompt asking whether or not to append to ~/.bash_profile . If the user don't want to, because they know they have a different setup - they could be informed by what to do to make it work (i.e append it manually somewhere them self).
I guess a reasoning for why this must be done also should be in place.
Further discussion could go on to whether or not find ~/.bash_profile -- I guess I'll have to read up on the bash startup files hierarchy.
from goto.
Look at bin/goto - https://github.com/technocake/goto/blob/master/bin/goto#L7-L11 - for how the cd-technique is implemented today.
And then look at the bash function named goto in start_goto - https://github.com/technocake/goto/blob/master/bin/start_goto#L47-L51
So the start_goto script is registering the bash function named goto, which then will source bin/goto each time you type goto in the terminal.
Chain of events:
source start_goto --makes goto function available--> goto(function) sources --> goto(script)
from goto.
Proposed fix is in pull request #12
from goto.
Install script now asks the user before it appends bash_profile
from goto.
Related Issues (20)
- Silence browser output HOT 3
- Refactor goto HOT 3
- Create plugin infrastructure that lets plugins register and respond to goto events HOT 18
- urls (or IRIs) with space is only added with the first part in goto HOT 1
- add goto origin (git remote)
- Detect and migrate all project data to new data structure HOT 2
- Ctrl + D and Ctrl + C -ing goto gives traceback in output HOT 1
- Truncated filepath with spaces - syntax error: Expected “"” but found end of script. (-2741) HOT 5
- goto copy not working in linux HOT 2
- goto open -- no such magicword named open HOT 1
- goto <magicword> <random> gives TypeError: argument of type 'bool' is not iterable
- goto add relative paths based on other magicwords
- jakdojade plugin (for traveling by public transport in poland)
- TypeError: usage() takes no arguments (4 given)
- Ah hoy! Failed to determine rcfile...
- goto spotify uris will only open the spotify client on linux
- OS-X execution error: Can’t get application "chrome". (-1728) HOT 2
- goto search
- Filepath issues on windows / vs \ HOT 1
- Make manual page for goto HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goto.