1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Add repo-ls command.

This commit is contained in:
David Steele 2021-02-05 10:07:43 -05:00
parent 73f61a1f60
commit 218cd078a6
5 changed files with 64 additions and 23 deletions

View File

@ -638,7 +638,6 @@ my $rhCommandDefine =
&CFGCMD_REPO_LS =>
{
&CFGDEF_INTERNAL => true,
&CFGDEF_LOG_FILE => false,
&CFGDEF_LOG_LEVEL_DEFAULT => DEBUG,
&CFGDEF_PARAMETER_ALLOWED => true,

View File

@ -1377,10 +1377,12 @@
</command>
<!-- OPERATION - REPO-LS COMMAND -->
<command id="repo-ls" name="Repository List Paths/Files">
<summary>List paths/files in the repository.</summary>
<command id="repo-ls" name="Repository List">
<summary>List files in a repository.</summary>
<text>Similar to the unix <cmd>ls</cmd> command but options and output are different. Only information provided by repository storage drivers is available: <id>name</id>, <id>type</id>, <id>size</id>, (modify) <id>time</id>, and <id>destination</id> (for drivers that support links).</text>
<text>Similar to the unix <cmd>ls</cmd> command but works on any supported repository type. This command is primarily for administration, investigation, and testing. It is not a required part of a normal <backrest/> setup.
The default text output prints one file name per line. JSON output is available by specifying <br-option>--output=json</br-option>.</text>
<option-list>
<!-- OPERATION - LS COMMAND - FILTER OPTION -->
@ -1389,7 +1391,7 @@
<text>The filter is applied against the file/path names before they are output.</text>
<example>(F|D|I)$</example>
<example>"(F|D|I)$"</example>
</option>
<!-- OPERATION - LS COMMAND - OUTPUT OPTION -->
@ -1400,6 +1402,13 @@
<ul>
<li><id>text</id> - Simple list with one file/link/path name on each line.</li>
<li><id>json</id> - Detailed file/link/path information in JSON format.</li>
</ul>In JSON format the available fields are:
<ul>
<li><id>name</id> - file/link/path name (and partial path when recursing).</li>
<li><id>type</id> - <id>file</id>, <id>path</id>, or <id>link</id>.</li>
<li><id>size</id> - size in bytes (files only).</li>
<li><id>time</id> - time last modified (files only).</li>
<li><id>destination</id> - link destination (links only).</li>
</ul></text>
<example>json</example>

View File

@ -26,6 +26,16 @@
</release-bug-list>
<release-feature-list>
<release-item>
<release-item-contributor-list>
<release-item-reviewer id="cynthia.shang"/>
<!-- Actually tester, but we don't have a tag for that yet -->
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p>Add <cmd>repo-ls</cmd> command.</p>
</release-item>
<release-item>
<release-item-contributor-list>
<release-item-contributor id="stefan.fercot"/>

View File

@ -308,23 +308,27 @@ static const unsigned char helpDataPack[] =
// repo-ls command
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x08, // Internal
pckTypeStr << 4 | 0x08, 0x23, // Summary
0x4C, 0x69, 0x73, 0x74, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x2F, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x20,
0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x2E,
pckTypeStr << 4 | 0x08, 0xDD, 0x01, // Description
pckTypeStr << 4 | 0x09, 0x1B, // Summary
0x4C, 0x69, 0x73, 0x74, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x20, 0x61, 0x20, 0x72, 0x65, 0x70, 0x6F,
0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x2E,
pckTypeStr << 4 | 0x08, 0xBA, 0x02, // Description
0x53, 0x69, 0x6D, 0x69, 0x6C, 0x61, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6E, 0x69, 0x78, 0x20,
0x6C, 0x73, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x62, 0x75, 0x74, 0x20, 0x6F, 0x70, 0x74, 0x69, 0x6F,
0x6E, 0x73, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x61, 0x72, 0x65, 0x20, 0x64, 0x69,
0x66, 0x66, 0x65, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x20, 0x4F, 0x6E, 0x6C, 0x79, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x72, 0x6D,
0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x70, 0x72, 0x6F, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x72, 0x65,
0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x20, 0x73, 0x74, 0x6F, 0x72, 0x61, 0x67, 0x65, 0x20, 0x64, 0x72, 0x69,
0x76, 0x65, 0x72, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6C, 0x61, 0x62, 0x6C, 0x65, 0x3A, 0x20, 0x6E,
0x61, 0x6D, 0x65, 0x2C, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2C, 0x20, 0x73, 0x69, 0x7A, 0x65, 0x2C, 0x20, 0x28, 0x6D, 0x6F,
0x64, 0x69, 0x66, 0x79, 0x29, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x2C, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x64, 0x65, 0x73, 0x74,
0x69, 0x6E, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x66, 0x6F, 0x72, 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x73,
0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6F, 0x72, 0x74, 0x20, 0x6C, 0x69, 0x6E, 0x6B, 0x73, 0x29,
0x2E,
0x6C, 0x73, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x62, 0x75, 0x74, 0x20, 0x77, 0x6F, 0x72, 0x6B, 0x73,
0x20, 0x6F, 0x6E, 0x20, 0x61, 0x6E, 0x79, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6F, 0x72, 0x74, 0x65, 0x64, 0x20, 0x72, 0x65,
0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2E, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20,
0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x69, 0x6D, 0x61, 0x72, 0x69, 0x6C, 0x79,
0x20, 0x66, 0x6F, 0x72, 0x20, 0x61, 0x64, 0x6D, 0x69, 0x6E, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2C,
0x20, 0x69, 0x6E, 0x76, 0x65, 0x73, 0x74, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x20, 0x61, 0x6E, 0x64, 0x20,
0x74, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x2E, 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20, 0x6E, 0x6F, 0x74, 0x20, 0x61,
0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6F, 0x66, 0x20, 0x61, 0x20,
0x6E, 0x6F, 0x72, 0x6D, 0x61, 0x6C, 0x20, 0x70, 0x67, 0x42, 0x61, 0x63, 0x6B, 0x52, 0x65, 0x73, 0x74, 0x20, 0x73, 0x65,
0x74, 0x75, 0x70, 0x2E, 0x0A, 0x0A,
0x54, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x6F, 0x75, 0x74,
0x70, 0x75, 0x74, 0x20, 0x70, 0x72, 0x69, 0x6E, 0x74, 0x73, 0x20, 0x6F, 0x6E, 0x65, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x20,
0x6E, 0x61, 0x6D, 0x65, 0x20, 0x70, 0x65, 0x72, 0x20, 0x6C, 0x69, 0x6E, 0x65, 0x2E, 0x20, 0x4A, 0x53, 0x4F, 0x4E, 0x20,
0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x69, 0x73, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6C, 0x61, 0x62, 0x6C, 0x65, 0x20,
0x62, 0x79, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x69, 0x6E, 0x67, 0x20, 0x2D, 0x2D, 0x6F, 0x75, 0x74, 0x70,
0x75, 0x74, 0x3D, 0x6A, 0x73, 0x6F, 0x6E, 0x2E,
// repo-put command
// -------------------------------------------------------------------------------------------------------------------------
@ -1757,7 +1761,7 @@ static const unsigned char helpDataPack[] =
pckTypeObj << 4 | 0x02, // Command repo-ls override begin
pckTypeStr << 4 | 0x09, 0x0E, // Summary
0x4F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x2E,
pckTypeStr << 4 | 0x08, 0xA7, 0x01, // Description
pckTypeStr << 4 | 0x08, 0xAE, 0x03, // Description
0x54, 0x68, 0x65, 0x20, 0x66, 0x6F, 0x6C, 0x6C, 0x6F, 0x77, 0x69, 0x6E, 0x67, 0x20, 0x6F, 0x75, 0x74, 0x70,
0x75, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6F,
0x72, 0x74, 0x65, 0x64, 0x3A, 0x0A, 0x0A,
@ -1768,7 +1772,25 @@ static const unsigned char helpDataPack[] =
0x2A, 0x20, 0x6A, 0x73, 0x6F, 0x6E, 0x20, 0x2D, 0x20, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x20,
0x66, 0x69, 0x6C, 0x65, 0x2F, 0x6C, 0x69, 0x6E, 0x6B, 0x2F, 0x70, 0x61, 0x74, 0x68, 0x20, 0x69, 0x6E, 0x66,
0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x69, 0x6E, 0x20, 0x4A, 0x53, 0x4F, 0x4E, 0x20, 0x66,
0x6F, 0x72, 0x6D, 0x61, 0x74, 0x2E,
0x6F, 0x72, 0x6D, 0x61, 0x74, 0x2E, 0x0A, 0x0A,
0x49, 0x6E, 0x20, 0x4A, 0x53, 0x4F, 0x4E, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65,
0x20, 0x61, 0x76, 0x61, 0x69, 0x6C, 0x61, 0x62, 0x6C, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6C, 0x64, 0x73, 0x20,
0x61, 0x72, 0x65, 0x3A, 0x0A, 0x0A,
0x2A, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x2F, 0x6C, 0x69, 0x6E, 0x6B,
0x2F, 0x70, 0x61, 0x74, 0x68, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x20, 0x28, 0x61, 0x6E, 0x64, 0x20, 0x70, 0x61,
0x72, 0x74, 0x69, 0x61, 0x6C, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x77, 0x68, 0x65, 0x6E, 0x20, 0x72, 0x65,
0x63, 0x75, 0x72, 0x73, 0x69, 0x6E, 0x67, 0x29, 0x2E, 0x0A,
0x2A, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x2D, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x2C, 0x20, 0x70, 0x61, 0x74,
0x68, 0x2C, 0x20, 0x6F, 0x72, 0x20, 0x6C, 0x69, 0x6E, 0x6B, 0x2E, 0x0A,
0x2A, 0x20, 0x73, 0x69, 0x7A, 0x65, 0x20, 0x2D, 0x20, 0x73, 0x69, 0x7A, 0x65, 0x20, 0x69, 0x6E, 0x20, 0x62,
0x79, 0x74, 0x65, 0x73, 0x20, 0x28, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x20, 0x6F, 0x6E, 0x6C, 0x79, 0x29, 0x2E,
0x0A,
0x2A, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x20, 0x6C, 0x61, 0x73, 0x74,
0x20, 0x6D, 0x6F, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x28, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x20, 0x6F,
0x6E, 0x6C, 0x79, 0x29, 0x2E, 0x0A,
0x2A, 0x20, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x2D, 0x20, 0x6C, 0x69,
0x6E, 0x6B, 0x20, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x6C, 0x69,
0x6E, 0x6B, 0x73, 0x20, 0x6F, 0x6E, 0x6C, 0x79, 0x29, 0x2E,
0x00, // Command repo-ls override end
0x00, // Command overrides end

View File

@ -34,6 +34,7 @@ testRun(void)
" expire Expire backups that exceed retention.\n"
" help Get help.\n"
" info Retrieve information about backups.\n"
" repo-ls List files in a repository.\n"
" restore Restore a database cluster.\n"
" stanza-create Create the required stanza data.\n"
" stanza-delete Delete a stanza.\n"