Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 197 lines (187 sloc) 6.305 kb
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
1 #!/usr/bin/perl
2
3 # Format s3cmd.1 manpage
4 # Usage:
5 # s3cmd --help | format-manpage.pl > s3cmd.1
6
7 use strict;
8
9 my $commands = "";
10 my $cfcommands = "";
d9c7251 @mludvig Improved format-manpage.pl
mludvig authored
11 my $wscommands = "";
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
12 my $options = "";
13
14 while (<>) {
15 if (/^Commands:/) {
16 while (<>) {
17 last if (/^\s*$/);
18 my ($desc, $cmd, $cmdline);
19 ($desc = $_) =~ s/^\s*(.*?)\s*$/$1/;
20 ($cmdline = <>) =~ s/^\s*s3cmd (.*?) (.*?)\s*$/s3cmd \\fB$1\\fR \\fI$2\\fR/;
21 $cmd = $1;
22 if ($cmd =~ /^cf/) {
23 $cfcommands .= ".TP\n$cmdline\n$desc\n";
d9c7251 @mludvig Improved format-manpage.pl
mludvig authored
24 } elsif ($cmd =~ /^ws/) {
25 $wscommands .= ".TP\n$cmdline\n$desc\n";
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
26 } else {
27 $commands .= ".TP\n$cmdline\n$desc\n";
28 }
29 }
30 }
31 if (/^Options:/) {
32 my ($opt, $desc);
33 while (<>) {
34 last if (/^\s*$/);
d9c7251 @mludvig Improved format-manpage.pl
mludvig authored
35 $_ =~ s/(.*?)\s*$/$1/;
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
36 $desc = "";
37 $opt = "";
d9c7251 @mludvig Improved format-manpage.pl
mludvig authored
38 if (/^ (-.*)/) {
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
39 $opt = $1;
40 if ($opt =~ / /) {
41 ($opt, $desc) = split(/\s\s+/, $opt, 2);
42 }
d9c7251 @mludvig Improved format-manpage.pl
mludvig authored
43 $opt =~ s/(-[^ ,=\.]+)/\\fB$1\\fR/g;
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
44 $opt =~ s/-/\\-/g;
45 $options .= ".TP\n$opt\n";
46 } else {
d9c7251 @mludvig Improved format-manpage.pl
mludvig authored
47 $_ =~ s/\s*(.*?)\s*$/$1/;
48 $_ =~ s/(--[^ ,=\.]+)/\\fB$1\\fR/g;
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
49 $desc .= $_;
50 }
51 if ($desc) {
52 $options .= "$desc\n";
53 }
54 }
55 }
56 }
57 print "
58 .TH s3cmd 1
59 .SH NAME
60 s3cmd \\- tool for managing Amazon S3 storage space and Amazon CloudFront content delivery network
61 .SH SYNOPSIS
62 .B s3cmd
63 [\\fIOPTIONS\\fR] \\fICOMMAND\\fR [\\fIPARAMETERS\\fR]
64 .SH DESCRIPTION
65 .PP
66 .B s3cmd
67 is a command line client for copying files to/from
68 Amazon S3 (Simple Storage Service) and performing other
69 related tasks, for instance creating and removing buckets,
70 listing objects, etc.
71
72 .SH COMMANDS
73 .PP
74 .B s3cmd
75 can do several \\fIactions\\fR specified by the following \\fIcommands\\fR.
76 $commands
77
78 .PP
d9c7251 @mludvig Improved format-manpage.pl
mludvig authored
79 Commands for static WebSites configuration
80 $wscommands
81
82 .PP
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
83 Commands for CloudFront management
84 $cfcommands
85
86 .SH OPTIONS
87 .PP
88 Some of the below specified options can have their default
89 values set in
90 .B s3cmd
91 config file (by default \$HOME/.s3cmd). As it's a simple text file
92 feel free to open it with your favorite text editor and do any
93 changes you like.
94 $options
95
96 .SH EXAMPLES
97 One of the most powerful commands of \\fIs3cmd\\fR is \\fBs3cmd sync\\fR used for
98 synchronising complete directory trees to or from remote S3 storage. To some extent
99 \\fBs3cmd put\\fR and \\fBs3cmd get\\fR share a similar behaviour with \\fBsync\\fR.
100 .PP
101 Basic usage common in backup scenarios is as simple as:
102 .nf
103 s3cmd sync /local/path/ s3://test-bucket/backup/
104 .fi
105 .PP
106 This command will find all files under /local/path directory and copy them
107 to corresponding paths under s3://test-bucket/backup on the remote side.
108 For example:
109 .nf
110 /local/path/\\fBfile1.ext\\fR \\-> s3://bucket/backup/\\fBfile1.ext\\fR
111 /local/path/\\fBdir123/file2.bin\\fR \\-> s3://bucket/backup/\\fBdir123/file2.bin\\fR
112 .fi
113 .PP
114 However if the local path doesn't end with a slash the last directory's name
115 is used on the remote side as well. Compare these with the previous example:
116 .nf
117 s3cmd sync /local/path s3://test-bucket/backup/
118 .fi
119 will sync:
120 .nf
121 /local/\\fBpath/file1.ext\\fR \\-> s3://bucket/backup/\\fBpath/file1.ext\\fR
122 /local/\\fBpath/dir123/file2.bin\\fR \\-> s3://bucket/backup/\\fBpath/dir123/file2.bin\\fR
123 .fi
124 .PP
125 To retrieve the files back from S3 use inverted syntax:
126 .nf
127 s3cmd sync s3://test-bucket/backup/ /tmp/restore/
128 .fi
129 that will download files:
130 .nf
131 s3://bucket/backup/\\fBfile1.ext\\fR \\-> /tmp/restore/\\fBfile1.ext\\fR
132 s3://bucket/backup/\\fBdir123/file2.bin\\fR \\-> /tmp/restore/\\fBdir123/file2.bin\\fR
133 .fi
134 .PP
135 Without the trailing slash on source the behaviour is similar to
136 what has been demonstrated with upload:
137 .nf
138 s3cmd sync s3://test-bucket/backup /tmp/restore/
139 .fi
140 will download the files as:
141 .nf
142 s3://bucket/\\fBbackup/file1.ext\\fR \\-> /tmp/restore/\\fBbackup/file1.ext\\fR
143 s3://bucket/\\fBbackup/dir123/file2.bin\\fR \\-> /tmp/restore/\\fBbackup/dir123/file2.bin\\fR
144 .fi
145 .PP
146 All source file names, the bold ones above, are matched against \\fBexclude\\fR
147 rules and those that match are then re\\-checked against \\fBinclude\\fR rules to see
148 whether they should be excluded or kept in the source list.
149 .PP
150 For the purpose of \\fB\\-\\-exclude\\fR and \\fB\\-\\-include\\fR matching only the
151 bold file names above are used. For instance only \\fBpath/file1.ext\\fR is tested
152 against the patterns, not \\fI/local/\\fBpath/file1.ext\\fR
153 .PP
154 Both \\fB\\-\\-exclude\\fR and \\fB\\-\\-include\\fR work with shell-style wildcards (a.k.a. GLOB).
155 For a greater flexibility s3cmd provides Regular-expression versions of the two exclude options
156 named \\fB\\-\\-rexclude\\fR and \\fB\\-\\-rinclude\\fR.
157 The options with ...\\fB\\-from\\fR suffix (eg \\-\\-rinclude\\-from) expect a filename as
158 an argument. Each line of such a file is treated as one pattern.
159 .PP
160 There is only one set of patterns built from all \\fB\\-\\-(r)exclude(\\-from)\\fR options
161 and similarly for include variant. Any file excluded with eg \\-\\-exclude can
162 be put back with a pattern found in \\-\\-rinclude\\-from list.
163 .PP
164 Run s3cmd with \\fB\\-\\-dry\\-run\\fR to verify that your rules work as expected.
165 Use together with \\fB\\-\\-debug\\fR get detailed information
166 about matching file names against exclude and include rules.
167 .PP
168 For example to exclude all files with \".jpg\" extension except those beginning with a number use:
169 .PP
170 \\-\\-exclude '*.jpg' \\-\\-rinclude '[0-9].*\\.jpg'
171 .SH SEE ALSO
172 For the most up to date list of options run
173 .B s3cmd \\-\\-help
174 .br
175 For more info about usage, examples and other related info visit project homepage at
176 .br
177 .B http://s3tools.org
da0fb7b @mludvig * s3cmd, s3cmd.1, format-manpage.pl: Improved --help text
mludvig authored
178 .SH DONATIONS
179 Please consider a donation if you have found s3cmd useful:
180 .br
181 .B http://s3tools.org/donate
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
182 .SH AUTHOR
da0fb7b @mludvig * s3cmd, s3cmd.1, format-manpage.pl: Improved --help text
mludvig authored
183 Written by Michal Ludvig <mludvig\@logix.net.nz> and 15+ contributors
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
184 .SH CONTACT, SUPPORT
185 Prefered way to get support is our mailing list:
186 .I s3tools\\-general\@lists.sourceforge.net
187 .SH REPORTING BUGS
188 Report bugs to
189 .I s3tools\\-bugs\@lists.sourceforge.net
190 .SH COPYRIGHT
d9c7251 @mludvig Improved format-manpage.pl
mludvig authored
191 Copyright \\(co 2007,2008,2009,2010,2011,2012 Michal Ludvig <http://www.logix.cz/michal>
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
192 .br
193 This is free software. You may redistribute copies of it under the terms of
194 the GNU General Public License version 2 <http://www.gnu.org/licenses/gpl.html>.
195 There is NO WARRANTY, to the extent permitted by law.
196 ";
Something went wrong with that request. Please try again.