counsyl / stor

A cross-compatible CLI and Python API for accessing block and object storage
https://counsyl.github.io/stor/
Other
35 stars 12 forks source link

Add canonicalize flag to cli functions list ls walkfiles #112

Closed anujkumar93 closed 5 years ago

anujkumar93 commented 5 years ago

@jtratner CC @pkaleta

This PR adds the canonicalize flag to list, ls and walkfiles options in the cli. Adding this flag will help in manipulating DX paths and resources. I had to add kwargs to function definitions of these 3 commands for swift, s3, posix to not break any apis. I added a few tests to depict nothing breaks for other paths even if we pass canonicalize flag. For DXPaths, I checked that the canonicalized paths are returned. For folders, the project is canonicalized, and the path to folder stays.

akumar$ stor ls dx://HMM_CNV_Test --canonicalize
dx://project-FK8pJ100x54yqG4x7XyK62v2:/StorTesting
dx://project-FK8pJ100x54yqG4x7XyK62v2:/parent
dx://project-FK8pJ100x54yqG4x7XyK62v2:/workflow-FPx2PgQ0x54Yq7pbBQ2Gf87K
dx://project-FK8pJ100x54yqG4x7XyK62v2:/applet-FPx2PgQ0x54bVqVzBQBZ0KGq
dx://project-FK8pJ100x54yqG4x7XyK62v2:/applet-FPx2Pg00x54V7kKFBVX9kQx8
dx://project-FK8pJ100x54yqG4x7XyK62v2:/file-FPJ5kyj0x54q55GP0z3x8Yyj
dx://project-FK8pJ100x54yqG4x7XyK62v2:/file-FK9FG600x54b37J3FF41K1Zy