Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funky creating global funks by default #130

Closed
niekvandepas opened this issue Nov 20, 2018 · 1 comment
Closed

funky creating global funks by default #130

niekvandepas opened this issue Nov 20, 2018 · 1 comment

Comments

@niekvandepas
Copy link

OS: Ubuntu 16.04
Python: 3.5.2
Funky: 3.1.0

I just clean installed funky using pip3 and am running into an issue where all local funks are available globally. It almost seems like gfunky is just aliased to funky:

$ cd ~
$ funky
> [ERROR] No local funks are defined in the current directory.
$ gfunky
> [ERROR] No global funks are defined.
$ funky -a test
> [INFO] Added funk "test".
$ funky
> test() { echo "hello world" "$@"; }
$ gfunky
> test() { echo "hello world" "$@"; }

$ cd /
$ gfunky
> test() { echo "hello world" "$@"; }
$ funky
> [ERROR] No local funks are defined in the current directory.
$ gfunky -r test
> [INFO] Removed funk "test".

$ cd ~
$ funky
> [ERROR] No local funks are defined in the current directory.
$ gfunky
> [ERROR] No global funks are defined.
@niekvandepas niekvandepas changed the title gfunky creating odd behavior funky creating global funks by default Nov 20, 2018
@bbugyi200
Copy link
Owner

bbugyi200 commented Nov 21, 2018

The way that funky is implemented right now, it is only able to approximate the concepts of local and global filesystem scope.

The way I envisioned it, all funks defined in a parent directory should also be available in the child directory. The logical conclusion of this design is that the local scope of the root directory (/) is functionally equivalent to the global scope of the entire system.

However, since funky uses a hidden local file (.funky) to store funks, it is not currently possible to create local funks in directories the user does not have write-access to. So funky treats the user's home directory as the global directory (i.e. it uses /home/user instead of /).

In conclusion, what you've noticed here is less a bug and more a fundamental flaw in the current design. Full support for local and global scopes is waiting on #124.

I'm going to close this issue so I don't forget, but if I have missed something please reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants