Update generated assets (#235)

This commit is contained in:
CosmicHorror 2023-10-02 16:52:13 -06:00 committed by GitHub
parent 4ed733834f
commit 6ee7e7ecd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 33 deletions

View file

@ -29,7 +29,7 @@ _sd() {
'--version[Print version]' \
':find -- The regexp or string (if -s) to search for:' \
':replace_with -- What to replace each match with. Unless in string mode, you may use captured values like $1, $2, etc:' \
'*::files -- The path to file(s). This is optional - sd can also read from STDIN. {n}{n}Note\: sd modifies files in-place by default. See documentation for examples:_files' \
'*::files -- The path to file(s). This is optional - sd can also read from STDIN:_files' \
&& ret=0
}

View file

@ -26,12 +26,12 @@ Register-ArgumentCompleter -Native -CommandName 'sd' -ScriptBlock {
[CompletionResult]::new('--flags', 'flags', [CompletionResultType]::ParameterName, 'Regex flags. May be combined (like `-f mc`).')
[CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Output result into stdout and do not modify files')
[CompletionResult]::new('--preview', 'preview', [CompletionResultType]::ParameterName, 'Output result into stdout and do not modify files')
[CompletionResult]::new('-F', 'F', [CompletionResultType]::ParameterName, 'Treat FIND and REPLACE_WITH args as literal strings')
[CompletionResult]::new('-F', 'F ', [CompletionResultType]::ParameterName, 'Treat FIND and REPLACE_WITH args as literal strings')
[CompletionResult]::new('--fixed-strings', 'fixed-strings', [CompletionResultType]::ParameterName, 'Treat FIND and REPLACE_WITH args as literal strings')
[CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Recursively replace files')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Print version')
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
break
}

View file

@ -47,4 +47,4 @@ _sd() {
esac
}
complete -F _sd -o bashdefault -o default sd
complete -F _sd -o nosort -o bashdefault -o default sd

View file

@ -1,63 +1,98 @@
.TH SD 1
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH sd 1 "sd 0.7.6"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH NAME
sd
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH SYNOPSIS
\fBsd\fR [FLAGS] find replace_with [FILES]
.SH FLAGS
\fBsd\fR [\fB\-p\fR|\fB\-\-preview\fR] [\fB\-F\fR|\fB\-\-fixed\-strings\fR] [\fB\-r \fR] [\fB\-n \fR] [\fB\-f\fR|\fB\-\-flags\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] <\fIFIND\fR> <\fIREPLACE_WITH\fR> [\fIFILES\fR]
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH DESCRIPTION
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH OPTIONS
.TP
\fB\-p\fR, \fB\-\-preview\fR
Emit the replacement to STDOUT
Output result into stdout and do not modify files
.TP
\fB\-s\fR, \fB\-\-string\-mode\fR
Treat expressions as non\-regex strings.
\fB\-F\fR, \fB\-\-fixed\-strings\fR
Treat FIND and REPLACE_WITH args as literal strings
.TP
\fB\-f\fR, \fB\-\-flags\fR
\fB\-r\fR
Recursively replace files
.TP
\fB\-n\fR=\fIREPLACEMENTS\fR
Limit the number of replacements
.TP
\fB\-f\fR, \fB\-\-flags\fR=\fIFLAGS\fR
Regex flags. May be combined (like `\-f mc`).
c \- case\-sensitive
e \- disable multi\-line matching
i \- case\-insensitive
m \- multi\-line matching
s \- make `.` match newlines
w \- match full words only
.SH EXIT STATUS
.TP
\fB0\fR
\fB\-h\fR, \fB\-\-help\fR
Print help (see a summary with \*(Aq\-h\*(Aq)
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version
.TP
<\fIFIND\fR>
The regexp or string (if \-s) to search for
.TP
<\fIREPLACE_WITH\fR>
What to replace each match with. Unless in string mode, you may use captured values like $1, $2, etc
.TP
[\fIFILES\fR]
The path to file(s). This is optional \- sd can also read from STDIN.
Note: sd modifies files in\-place by default. See documentation for examples.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH "EXIT STATUS"
.IP 0
Successful program execution.
.TP
\fB1\fR
.IP 1
Unsuccessful program execution.
.TP
\fB101\fR
.IP 101
The program panicked.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH EXAMPLES
.TP
String\-literal mode
\fB$ echo 'lots((([]))) of special chars' | sd \-s '((([])))' ''\fR
\fB$ echo \*(Aqlots((([]))) of special chars\*(Aq | sd \-s \*(Aq((([])))\*(Aq\fR
.br
lots of special chars
.TP
Regex use. Let's trim some trailing whitespace
\fB$ echo 'lorem ipsum 23 ' | sd '\s+$' ''\fR
Regex use. Let\*(Aqs trim some trailing whitespace
\fB$ echo \*(Aqlorem ipsum 23 \*(Aq | sd \*(Aq\\s+$\*(Aq \*(Aq\*(Aq\fR
.br
lorem ipsum 23
.TP
Indexed capture groups
\fB$ echo 'cargo +nightly watch' | sd '(\w+)\s+\+(\w+)\s+(\w+)' 'cmd: $1, channel: $2, subcmd: $3'\fR
.br
cmd: cargo, channel: nightly, subcmd: watch
.TP
Named capture groups
\fB$ echo "123.45" | sd '(?P<dollars>\d+)\.(?P<cents>\d+)' '$dollars dollars and $cents cents'\fR
\fB$ echo \*(Aqcargo +nightly watch\*(Aq | sd \*(Aq(\\w+)\\s+\\+(\\w+)\\s+(\\w+)\*(Aq \*(Aqcmd: $1, channel: $2, subcmd: $3\*(Aq\fR
.br
123 dollars and 45 cents
.TP
Find & replace in file
\fB$ sd 'window.fetch' 'fetch' http.js\fR
\fB$ sd \*(Aqwindow.fetch\*(Aq \*(Aqfetch\*(Aq http.js\fR
.br
.TP
Find & replace from STDIN an emit to STDOUT
\fB$ sd 'window.fetch' 'fetch' < http.js\fR
\fB$ sd \*(Aqwindow.fetch\*(Aq \*(Aqfetch\*(Aq < http.js\fR
.br