Closed yarikoptic closed 4 years ago
So search wouldn’t suffice here?
think docker, git -- you can search/show full id, but you never use it really. It is a great convenience IMHO. With search you need first to search, cut/paste, run target command
Good point - what I'll do is first check for an exact match, then check for a partial, and only return the result if there is one partial match.
Okay here is an example, showing do a partial search for an existing, one for a prefix not existing, and one for a search that returns more than one result:
$ qme ls
Database: sqlite
1 shell-38f2535a-e38f-4bc4-8667-9c43726b1e7e ls
2 shell-de58f61b-81da-467c-981c-497f7ae8556b echo Hello Moto
3 shell-c231699a-4c3e-43f0-961f-2829d16d588c echo Hello Another Moto
4 shell-9238cace-6cec-40cd-8e8d-b7d817217e2c
5 shell-784bf5bd-9d48-4972-9acd-98ee1f7f0099 echo hello
6 shell-5031c6a1-ca4c-4f05-8131-db3e88f08e6b I am echoing a thing
7 shell-1c2f96eb-0769-41d2-a691-fc1bf1c691b8 I am echoing a thing
8 shell-93af2d3e-ed4d-43fd-9f4e-8f1ca2d83750 I am echoing a thing
9 shell-645df5bd-ebb6-4d8d-ac80-57eda01cdf4f I am echoing a thing
10 shell-217968a5-4515-43fa-b311-a9a28f3cfbed I am echoing a thing
11 shell-2df8f75d-c659-4cbc-a7d2-7e18aae5f474
12 shell-9817744f-77ae-4e8b-ac2e-2e326bc11d7b echo hello
Just one exists
$ qme get shell-3
Database: sqlite
{
"executor": "shell",
"uid": "shell-38f2535a-e38f-4bc4-8667-9c43726b1e7e",
"data": {
"pwd": "/home/vanessa",
"user": "vanessa",
"timestamp": "2020-05-22 10:17:24.162844",
"output": [
"anaconda3\n",
"Desktop\n",
"Documents\n",
"Downloads\n",
"examples.desktop\n",
"go\n",
"Music\n",
"Pictures\n",
"Public\n",
"singularity-images_latest.sif\n",
"snap\n",
"Templates\n",
"Videos\n"
],
"error": [],
"returncode": 0,
"pid": 2421,
"cmd": [
"ls"
],
"status": "complete"
},
"command": "ls"
}
More than one exists
$ qme get shell-2
Database: sqlite
More than one task found for shell-2
None exist
$ qme get shell-28888
Database: sqlite
Cannot find task shell-28888
sweet!
Fixed with #32
Similar to how git, docker (and reproman) matches IDs, it would be great if you could allow for partial match whenever it is not ambiguous:
so qme could just figure out full ID and report for it. That is where dynamic completions of argcomplete could also come very handy