Comments (7)
Sounds reasonable, I'll have a think about how it can work.
FYI, I have made some changes in revisions be219acd and 0d4c6abd to improve untagging performance. (I will still look at your suggestion of reading actions from standard input.)
from tmsu.
This is now implemented. Pass - as the sole argument in order to read from standard input. Let me know of any issues.
from tmsu.
Good to see this progressing.
I have a bug report:
The parser breaks on arguments containing spaces.
for example the pretty conventional usage tag --tags="foo bar"
:
echo foo > /tmp/foo
- create this input file, testcase1.txt:
-D /tmp/foo-bar.db tag --tags="foo bar" /tmp/foo
-D /tmp/foo-bar.db tags /tmp/foo
tmsu - < testcase1.txt
Result:
tmsu: New tag '"foo'.
tmsu: bar": no such file
If you make the obvious modification, removing the quotes, that is broken in a slightly different way:
tmsu: New tag 'foo'.
tmsu: bar: no such file
"foo
- This problem also comes up with any filename that has a space in it. You can observe this by changing the database name to /tmp/foo bar.db in the above test-case.
- I suggest that you either need a different convention (for example, one argument per line, with the end of a command being blank line or EOF), or need to allow spaces to be escaped. I'm personally in favor of the former, since it makes script generation very simple.
To rewrite the above test-script in the format I suggested, looks like this:
-D=/tmp/foo-bar.db
tag
--tags=foo bar
/tmp/foo
-D=/tmp/foo-bar.db
tags
/tmp/foo
A bit more stretched out, but pretty clear imo
I made a working prototype of this idea -- see read_args(), parse_file() , and I realized that a 'prelude' is also a good option. That's a section that comes before actual commands, specifying options to share between every executed command. To illustrate, that would look like
-D=/tmp/foo-bar.db
tag
--tags=foo bar
/tmp/foo
tags
/tmp/foo
for the same test-script, removing the need to repeat global options like -D or -v in each individual commandline.
from tmsu.
Thanks, I'll take a look. Not sure about the argument per line idea as I'd
rather keep a single syntax, plus you'd have to have an unintuitive blank
line between each subcommand.
I think the better solution is if I build a line parser that's aware of
quotation marks.
Sorry to get your hopes up when it so blatantly doesn't work.
On 18 Dec 2014 02:23, "0ion9" [email protected] wrote:
The parser breaks on spaces.
for example the pretty conventional usage tag --tags="foo bar":
- echo foo > /tmp/foo
- create this input file, testcase1.txt:
-D /tmp/foo-bar.db tag --tags="foo bar" /tmp/foo
-D /tmp/foo-bar.db tags /tmp/foo
- tmsu - < testcase1.txt
Result:
tmsu: New tag '"foo'.
tmsu: bar": no such fileIf you make the obvious modification, removing the quotes, that is broken
in a slightly different way:tmsu: New tag 'foo'.
tmsu: bar: no such file
"foo
This problem also comes up with any filename that has a space in it.
You can observe this by changing the database name to /tmp/foo bar.db in
the above test-case.I suggest that you either need a different convention (for example,
one argument per line, with the end of a command being blank line or EOF),
or need to allow spaces to be escaped. I'm personally in favor of the
former, since it makes script generation very simple.—
Reply to this email directly or view it on GitHub
#6 (comment).
from tmsu.
Also, you can specify the database before the instruction to read from
standard input. In fact I believe you have to otherwise it will have
already opened the database by that point.
On 18 Dec 2014 02:30, "Paul Ruane" [email protected] wrote:
Thanks, I'll take a look. Not sure about the argument per line idea as I'd
rather keep a single syntax, plus you'd have to have an unintuitive blank
line between each subcommand.I think the better solution is if I build a line parser that's aware of
quotation marks.Sorry to get your hopes up when it so blatantly doesn't work.
On 18 Dec 2014 02:23, "0ion9" [email protected] wrote:The parser breaks on spaces.
for example the pretty conventional usage tag --tags="foo bar":
- echo foo > /tmp/foo
- create this input file, testcase1.txt:
-D /tmp/foo-bar.db tag --tags="foo bar" /tmp/foo
-D /tmp/foo-bar.db tags /tmp/foo
- tmsu - < testcase1.txt
Result:
tmsu: New tag '"foo'.
tmsu: bar": no such fileIf you make the obvious modification, removing the quotes, that is broken
in a slightly different way:tmsu: New tag 'foo'.
tmsu: bar: no such file
"foo
This problem also comes up with any filename that has a space in it.
You can observe this by changing the database name to /tmp/foo bar.db in
the above test-case.I suggest that you either need a different convention (for example,
one argument per line, with the end of a command being blank line or EOF),
or need to allow spaces to be escaped. I'm personally in favor of the
former, since it makes script generation very simple.—
Reply to this email directly or view it on GitHub
#6 (comment).
from tmsu.
Parsing now handles quoted text correctly.
from tmsu.
Was this feature removed?
Building from latest, I get:
$ tmsu -
tmsu: invalid subcommand '-'
from tmsu.
Related Issues (20)
- Need python example on how to import the tags for a file from a sqlite database into TMSU HOT 1
- Confusing status command behavior HOT 1
- ...
- Duplicated tags in file system HOT 1
- Repair files by automatically locating files based on checksum? HOT 2
- List all the tags with values HOT 11
- small contribution: sc-im interface for changing tmsu tags HOT 2
- Question: what does the error message mean? HOT 3
- --name=never removes lines HOT 2
- database locked occasionally
- VFS can be very slow
- Feature Request in VFS: Listing files outside of the `files` folder and hiding `queries` folder
- Cannot install TMSU HOT 1
- Package available in Void Linux
- too many SQL variables - transport endpoint is not connected when too many tag values exist
- Use unique indexes and upserts? HOT 1
- "tmsu init" ignores TMSU_DB environment variable
- release v0.8 HOT 2
- `tmsu tag -h` should be an alias for `tmsu help tag`
- `tmsu repair` should operate on the root or on `.` if no paths are given
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 tmsu.