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

Path syntax addition #47

Open
Victorious3 opened this issue Mar 25, 2024 · 0 comments
Open

Path syntax addition #47

Victorious3 opened this issue Mar 25, 2024 · 0 comments
Labels
proposal New feature or request

Comments

@Victorious3
Copy link
Contributor

Victorious3 commented Mar 25, 2024

In light of potentially using Princess as a shell replacement it would make sense to have something as crucial as paths and their manipulation as a language feature.

It could work like this:

let segment = "folder name"
let p1 = ./some_path/{segment}/more_path/
let p2 = #/root/path/{p1}/../up
let p3 = ./some_path/{segment}
let p4 = ./some\ path\ with\ spaces/
let p5 = ./"how about this"/instead
let p6 = ~/relative/to/home

Paths may be concatinated with other paths or alternatively strings directly.
A path would be introduced by either a unary #/ for absolute paths, ~/ for paths relative to the home directory or a ./ for paths relative to the current working directory.
The path ends with a space or alternatively a closing /.

Additonally one could support globs as part of paths:

for var p in ./some/path/*.txt {
    print(p)
}

These would return a special Glob structure instead of a Path.

@Victorious3 Victorious3 added the proposal New feature or request label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant