Opened at 2012-11-21T18:41:38Z
Last modified at 2013-03-17T18:06:51Z
#1873 new enhancement
add a show-caps command
Reported by: | igor | Owned by: | igor |
---|---|---|---|
Priority: | normal | Milestone: | soon |
Component: | code-frontend-cli | Version: | 1.9.2 |
Keywords: | tahoe-ls usability | Cc: | |
Launchpad Bug: |
Description
I wanted a way to get the readcap of a directory created with tahoe create-alias without having to resort to the welcome page. zooko suggested tahoe debug dump-cap and some hand-crafting, which is doable but quite ugly.
Here is a patch against current master to add a tahoe show-caps command which will list whatever capabilities the GET?t=json API gives.
Because I have only superficial knowledge of the software architecture and given that tahoe_showcaps.py is pretty much a modified version of tahoe_ls.py, feel free to criticize and suggest.
Attachments (1)
Change History (16)
Changed at 2012-11-21T18:42:10Z by igor
comment:1 follow-ups: ↓ 3 ↓ 4 Changed at 2012-11-22T00:58:23Z by davidsarah
comment:2 Changed at 2012-11-22T00:59:13Z by davidsarah
- Component changed from unknown to code-frontend-cli
- Keywords tahoe-ls usability added
- Owner changed from davidsarah to igor
- Version set to 1.9.2
comment:3 in reply to: ↑ 1 ; follow-up: ↓ 6 Changed at 2012-11-22T01:45:59Z by zooko
Replying to davidsarah:
tahoe ls already has --uri and --readonly-uri options. Would adding an option to print the verify cap satisfy your requirement, or is the issue that tahoe ls for a directory will only display caps of children, not the directory itself?
Speaking for myself, not for igor, that wouldn't suffice, because I sometimes want to diminish a cap that I have that is not the child of any directory.
comment:4 in reply to: ↑ 1 Changed at 2012-11-22T02:11:45Z by igor
Replying to davidsarah:
tahoe ls already has --uri and --readonly-uri options. Would adding an option to print the verify cap satisfy your requirement, or is the issue that tahoe ls for a directory will only display caps of children, not the directory itself?
Yes, it will only display caps of children.
comment:5 follow-up: ↓ 7 Changed at 2012-11-22T02:13:02Z by igor
Also, there is a question in tahoe_showcaps.py:46. I was not sure if that check was still necessary when copying things from tahoe_ls.py.
comment:6 in reply to: ↑ 3 Changed at 2012-11-22T07:20:22Z by davidsarah
Replying to zooko:
Replying to davidsarah:
tahoe ls already has --uri and --readonly-uri options. Would adding an option to print the verify cap satisfy your requirement, or is the issue that tahoe ls for a directory will only display caps of children, not the directory itself?
Speaking for myself, not for igor, that wouldn't suffice, because I sometimes want to diminish a cap that I have that is not the child of any directory.
If it's a mutable file writecap, then tahoe ls --readonly-uri $CAP will do that. It's just for directory writecaps that tahoe ls will only display the children.
comment:7 in reply to: ↑ 5 Changed at 2012-11-22T07:21:15Z by davidsarah
Replying to igor:
Also, there is a question in tahoe_showcaps.py:46. I was not sure if that check was still necessary when copying things from tahoe_ls.py.
It's still necessary.
comment:8 Changed at 2013-01-22T10:57:39Z by zooko
- Keywords review-needed added
There is a patch attached to this ticket! (Thanks, igor.) So, should this ticket be in the review-needed state? Adding the review-needed tag. Someone please review this patch (per wiki:PatchReviewProcess) and update this ticket!
comment:9 follow-up: ↓ 10 Changed at 2013-03-01T02:38:02Z by davidsarah
My argument was that this should be functionality of tahoe ls rather than a separate command, and I pointed out the existing --uri and --readonly-uri options.
Zooko in comment:3 asked for the ability to diminish a cap that is not the child of any directory, but I pointed out in comment:6 that tahoe ls --readonly-uri $CAP already does this, except for the case of wanting to diminish a writecap to a directory. So, perhaps tahoe ls --readonly-uri $DIRCAP should print the directory readcap as well as listing the children?
comment:10 in reply to: ↑ 9 ; follow-ups: ↓ 12 ↓ 13 Changed at 2013-03-11T05:08:26Z by zooko
- Keywords review-needed removed
Replying to davidsarah:
My argument was that this should be functionality of tahoe ls rather than a separate command, and I pointed out the existing --uri and --readonly-uri options.
Zooko in comment:3 asked for the ability to diminish a cap that is not the child of any directory, but I pointed out in comment:6 that tahoe ls --readonly-uri $CAP already does this, except for the case of wanting to diminish a writecap to a directory. So, perhaps tahoe ls --readonly-uri $DIRCAP should print the directory readcap as well as listing the children?
Okay I was confused about this until now. Is it fair to say that the argument to ls is a "rooted path" (ref #1732), which can denote either a file or a directory, and ls shows some facts about the thing (such as the filesize if it is the file, or the names and facts about its children if it is a directory), and with the --uri option it also shows the cap to the thing, and with the --readonly-uri it also shows the read-only cap to the thing?
Okay, that makes sense now. +1
So now this patch is insufficient because in the current version of this patch, it won't show the cap if the rooted path denotes a directory. Is that true?
Removing the "review-needed" tag.
Igor: are you willing to extend this patch so it will show the caps of directories as well? Assigning to Igor.
comment:11 Changed at 2013-03-11T05:09:05Z by zooko
- Milestone changed from undecided to 1.11.0
This is almost ready so I'm putting it in the "1.11.0" Milestone.
comment:12 in reply to: ↑ 10 Changed at 2013-03-12T04:05:57Z by igor
Replying to zooko:
Igor: are you willing to extend this patch so it will show the caps of directories as well? Assigning to Igor.
I think there is some misunderstanding (and it may very well be on my part), so could you explain what is missing in the following output?
http://www.sebsauvage.net/paste/?0dee6b6fcea97009#9W96Pdr8NFqqF3Ubkon2tDp8Dy659GLeG3nDgCF8SO8=
My motivation for the patch was simply to have the CLI mimic the 'More info' webpage, and to me it seems it would add too much clutter to the listing done by tahoe ls.
comment:13 in reply to: ↑ 10 Changed at 2013-03-15T05:27:38Z by davidsarah
Replying to zooko:
So now this patch is insufficient because in the current version of this patch, it won't show the cap if the rooted path denotes a directory. Is that true?
No. The patch adds a new tahoe show-caps command; I was arguing that that wasn't needed because tahoe ls can almost do the same thing.
comment:14 Changed at 2013-03-15T05:28:38Z by davidsarah
... and if we were going to add a show-caps command, its implementation should probably share more code with some existing command.
comment:15 Changed at 2013-03-17T18:06:51Z by igor
How about the following 'cap listing mode' for tahoe ls?
$ tahoe ls --show-caps teste: .: rw_uri URI:DIR2:cmpj4sqyw5w67cwozpuxy5mjva:idcbiymnzp3dvn6tweva6anzzppl5ryjh7qzdydwmxx3qx3r7lda ro_uri URI:DIR2-RO:z2dt53oudwthl6l7sf3qrqtgba:idcbiymnzp3dvn6tweva6anzzppl5ryjh7qzdydwmxx3qx3r7lda verify_uri URI:DIR2-Verifier:tphasacmnjmtdnkgq74i4xmujm:idcbiymnzp3dvn6tweva6anzzppl5ryjh7qzdydwmxx3qx3r7lda node.url: ro_uri URI:LIT:nb2hi4b2f4xtcmrxfyyc4mboge5dgnbvgyxqu daew.xls: rw_uri URI:SSK:kejpnuetpuc3j2rmtjpwuwwqz4:mhj6t63hv2s6pgjxmp6oceencmp4265jbqegxfuq4koc4lpxujkq ro_uri URI:SSK-RO:5ksx7c3xhix52yqnipd2yotoue:mhj6t63hv2s6pgjxmp6oceencmp4265jbqegxfuq4koc4lpxujkq verify_uri URI:SSK-Verifier:sln55mmxjm6p2woafl5i3iojvi:mhj6t63hv2s6pgjxmp6oceencmp4265jbqegxfuq4koc4lpxujkq
Though this could be cumbersome if all you want is the directory's caps and it happens to have too many children.
tahoe ls already has --uri and --readonly-uri options. Would adding an option to print the verify cap satisfy your requirement, or is the issue that tahoe ls for a directory will only display caps of children, not the directory itself?