Comments (4)
First of all, thank you for reporting this issue! However, it has nothing to do with fselect
itself. That's the ^
that makes shell behave "bad". To prevent the issue put the whole query into the quotes like this:
fselect "name where name =~ '^\.'"
You can put quotes only around the regexp itself, but as soon as query starts becoming more complex (using parentheses etc.), it's safer to guard it as the whole.
from fselect.
Thanks for your solution. The command you posted does indeed work.
However, I don’t think the ^
is making my Fish shell behave any differently. The ^
was quoted, and the shell doesn’t seem to be interpreting it:
$ printf '%s' '^\.'
^\.
$ printf '%s' '^\.' | wc -c
3
From the following experiments, the problem seems more likely to be in fselect
’s argument parsing:
$ fselect name where name =~ '^\.'
some-file
$ fselect 'name where name =~ ^\.'
some-file
$ fselect "name where name =~ '^\.'"
$ fselect 'name where name =~ "^\."'
$ fselect name where name =~ '"^\."'
$
It looks like fselect
requires that the regex argument after =~
be given literal quotes, visible to fselect
and not just the shell, if the regex starts with ^
.
I would call this behavior a bug in fselect
’s internal argument parsing that should be fixed eventually. fselect
should have all the information it needs to understand the regex after =~
. It shouldn’t need literal quotes, because the shell is already giving the regex as a single argument. At the very least, if quotes are required, fselect
should issue an error about it instead of parsing the regex wrong.
However, it’s fine to give this bug low priority, because as you showed me, there is a way to write the query that doesn’t trigger this bug. The bug will only confuse new users, not make a certain type of query impossible.
from fselect.
Oh, yes, please forgive me the previous answer. I was wrong in deciding what is faulting there.
When you pass the query like this:
fselect name where name =~ '^\.'
the last argument is being received not as a string with quotes, but without them. Simply ^\.
. I suppose this is the intended shell behavior to allow passing strings with spaces. That ^\.
should suffice for a regexp parsing, sure, but next lexer treats that string like it has escapes inside. So it throws \
away, and we finally get ^.
, that goes to query parser.
What could be done there is probably to narrow down the escape sequences to \
and \\
.
What are they for after all? To allow queries like that:
fselect name from some\ dir\ with\ spaces
And escaping logic doesn't work for regular string with quotes (for now, at least), and on Windows as well (to be more usable with PowerShell).
from fselect.
Removed escaping behavior as it confuses users.
from fselect.
Related Issues (20)
- Extraneous horizontal tab at end of single/last output column HOT 2
- `into json` needs commas for object separators HOT 1
- json output missing comma separator HOT 2
- permission denied when using fselect in folder with lost+found
- Suggestion for how to compare contents of two paths?
- following a question on StackOverFlow HOT 3
- created not working HOT 2
- SQLite backend in the future? HOT 3
- Automatically build debs with each release
- Print a message if a newer version is available
- thread 'main' panicked at 'Illegal datetime format' HOT 2
- [Build fail] mp4parse now will cause 'error[E0277]: cannot multiply `u64` by `NonZeroU8`' HOT 5
- `depth` is not recognized when I don't mention any path HOT 1
- Support rust 1.70.0 HOT 4
- Donation for fselect HOT 1
- Need lib.rs to include fselect as a library in another Rust binary HOT 1
- support between operator HOT 1
- Duration for MP3 is in seconds, but for mp4 in it is in milliseconds HOT 1
- Please rename the release name to standard form.
- Alternative to SQL: SPL
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 fselect.