escape backticks in documentation

This commit is contained in:
Gokcehan committed 2016-09-15 17:08:05 +03:00
1 parent 6094078185
commit b0b06c46d2
4 files changed
+78 -47

No files matched your search

+28 -20
View File
@@ -10,7 +10,7 @@ at https://godoc.org/github.com/gokcehan/lf.
Reference Reference
The following commands and default keybindings are provided by lf. The following commands are provided by lf with default keybindings.
up (default "k" and "<up>") up (default "k" and "<up>")
half-up (default "<c-u>") half-up (default "<c-u>")
@@ -35,6 +35,11 @@ The following commands and default keybindings are provided by lf.
paste (default "p") paste (default "p")
renew (default "<c-l>") renew (default "<c-l>")
The following commands are provided by lf without default keybindings.
echo
cd
The following options can be used to customize the behavior of lf. The following options can be used to customize the behavior of lf.
hidden bool (default off) hidden bool (default off)
@@ -53,6 +58,8 @@ The following variables are exported for shell commands.
$fs marked file(s) separated with ':' $fs marked file(s) separated with ':'
$fx current file or marked file(s) if any $fx current file or marked file(s) if any
Configuration
The configuration file should either be located in "$XDG_CONFIG_HOME/lf/lfrc" The configuration file should either be located in "$XDG_CONFIG_HOME/lf/lfrc"
or "~/.config/lf/lfrc". A sample configuration file can be found at or "~/.config/lf/lfrc". A sample configuration file can be found at
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example. https://github.com/gokcehan/lf/blob/master/etc/lfrc.example.
@@ -75,17 +82,17 @@ default these modes are mapped to the prefix keys above.
Syntax Syntax
Characters from "#" to the line end are comments and ignored. Characters from "#" to "\n" are comments and ignored.
There are three special commands for configuration. There are three special commands for configuration.
"set" is used to set an option which could be (1) bool (e.g. "set hidden", "set "set" is used to set an option which could be bool (e.g. "set hidden", "set
nohidden", "set hidden!") (2) int (e.g. "set scrolloff 10") (3) string (e.g. nohidden", "set hidden!"), int (e.g. "set scrolloff 10"), or string (e.g. "set
"set sortby time"). sortby time").
"map" is used to bind a key to a command which could be (1) built-in command "map" is used to bind a key to a command which could be built-in command (e.g.
(e.g. "map gh cd ~") (2) custom command (e.g. "map D trash") (3) shell command "map gh cd ~"), custom command (e.g. "map D trash"), or shell command (e.g.
(e.g. "map i $less "$f"", "map u !du -h . | less"). You can delete an existing "map i $less "$f"", "map u !du -h . | less"). You can delete an existing
binding by leaving the expression empty (e.g. "map gh"). binding by leaving the expression empty (e.g. "map gh").
"cmd" is used to define a custom command or delete an existing command by "cmd" is used to define a custom command or delete an existing command by
@@ -96,20 +103,10 @@ group statements until a "\n" occurs. This is especially useful for "map" and
"cmd" commands. If you need multiline you can wrap statements in "{{" and "}}" "cmd" commands. If you need multiline you can wrap statements in "{{" and "}}"
after the proper prefix. after the proper prefix.
File Operations
lf uses the underlying "cp" and "mv" shell commands for file operations. For
this purpose, when you "yank" (i.e. copy) a file, it doesn't actually copy the
file on the disk, but only records its name to memory. The actual file
operation takes place when you do the "paste" in which case the "cp" command is
used. Similarly the "mv" command is used for "delete" (i.e. cut or kill)
followed by "paste". These traditional names (e.g. "yank" and "delete") are
picked instead of the other common convention (e.g. copy and cut) to resemble
the default keybinds for these operations.
Custom Commands Custom Commands
To wrap up let us write a shell command to move selected file(s) to trash. For demonstration let us write a shell command to move selected file(s) to
trash.
A first attempt to write such a command may look like this: A first attempt to write such a command may look like this:
@@ -150,6 +147,17 @@ This could be especially useful for interactive use (e.g. "rm $fs" would simply
work). This option is not set by default as things may behave unexpectedly at work). This option is not set by default as things may behave unexpectedly at
other places. other places.
File Operations
lf uses the underlying "cp" and "mv" shell commands for file operations. For
this purpose, when you "yank" (i.e. copy) a file, it doesn't actually copy the
file on the disk, but only records its name to memory. The actual file
operation takes place when you do the "paste" in which case the "cp" command is
used. Similarly the "mv" command is used for "delete" (i.e. cut or kill)
followed by "paste". These traditional names (e.g. "yank" and "delete") are
picked instead of the other common convention (e.g. copy and cut) to resemble
the default keybinds for these operations.
Opening Files Opening Files
You can use "open-file" command to open a file. This is a special command You can use "open-file" command to open a file. This is a special command
+36 -25
View File
@@ -2,7 +2,8 @@
package main package main
var genDocString = `lf is a terminal file manager. var genDocString = `
lf is a terminal file manager.
Source code can be found in the repository at Source code can be found in the repository at
https://github.com/gokcehan/lf. https://github.com/gokcehan/lf.
@@ -13,7 +14,7 @@ online at https://godoc.org/github.com/gokcehan/lf.
Reference Reference
The following commands and default keybindings are provided by lf. The following commands are provided by lf with default keybindings.
up (default "k" and "<up>") up (default "k" and "<up>")
half-up (default "<c-u>") half-up (default "<c-u>")
@@ -38,6 +39,11 @@ The following commands and default keybindings are provided by lf.
paste (default "p") paste (default "p")
renew (default "<c-l>") renew (default "<c-l>")
The following commands are provided by lf without default keybindings.
echo
cd
The following options can be used to customize the behavior of lf. The following options can be used to customize the behavior of lf.
hidden bool (default off) hidden bool (default off)
@@ -56,6 +62,9 @@ The following variables are exported for shell commands.
$fs marked file(s) separated with ':' $fs marked file(s) separated with ':'
$fx current file or marked file(s) if any $fx current file or marked file(s) if any
Configuration
The configuration file should either be located in The configuration file should either be located in
"$XDG_CONFIG_HOME/lf/lfrc" or "~/.config/lf/lfrc". A sample configuration "$XDG_CONFIG_HOME/lf/lfrc" or "~/.config/lf/lfrc". A sample configuration
file can be found at file can be found at
@@ -81,43 +90,32 @@ that by default these modes are mapped to the prefix keys above.
Syntax Syntax
Characters from "#" to the line end are comments and ignored. Characters from "#" to "\n" are comments and ignored.
There are three special commands for configuration. There are three special commands for configuration.
"set" is used to set an option which could be (1) bool (e.g. "set hidden", "set" is used to set an option which could be bool (e.g. "set hidden", "set
"set nohidden", "set hidden!") (2) int (e.g. "set scrolloff 10") (3) string nohidden", "set hidden!"), int (e.g. "set scrolloff 10"), or string (e.g.
(e.g. "set sortby time"). "set sortby time").
"map" is used to bind a key to a command which could be (1) built-in command "map" is used to bind a key to a command which could be built-in command
(e.g. "map gh cd ~") (2) custom command (e.g. "map D trash") (3) shell (e.g. "map gh cd ~"), custom command (e.g. "map D trash"), or shell command
command (e.g. "map i $less "$f"", "map u !du -h . | less"). You can delete (e.g. "map i $less "$f"", "map u !du -h . | less"). You can delete an
an existing binding by leaving the expression empty (e.g. "map gh"). existing binding by leaving the expression empty (e.g. "map gh").
"cmd" is used to define a custom command or delete an existing command by "cmd" is used to define a custom command or delete an existing command by
leaving the expression empty (e.g. "cmd trash"). leaving the expression empty (e.g. "cmd trash").
If there is no prefix then ":" is assumed. An explicit ":" could be provided If there is no prefix then ":" is assumed. An explicit ":" could be provided
to group statements until a " to group statements until a "\n" occurs. This is especially useful for "map"
" occurs. This is especially useful for "map"
and "cmd" commands. If you need multiline you can wrap statements in "{{" and "cmd" commands. If you need multiline you can wrap statements in "{{"
and "}}" after the proper prefix. and "}}" after the proper prefix.
Yank/Delete/Paste
lf uses the underlying "cp" and "mv" shell commands for file operations. For
this purpose, when you "yank" (i.e. copy) a file, it doesn't actually copy
the file on the disk, but only records its name to memory. The actual file
operation takes place when you do the "paste" in which case the "cp" command
is used. Similarly the "mv" command is used for "delete" (i.e. cut or kill)
followed by "paste". These traditional names (e.g. "yank" and "delete") are
picked instead of the other common convention (e.g. copy and cut) to
resemble the default keybinds for these operations.
Custom Commands Custom Commands
To wrap up let us write a shell command to move selected file(s) to trash. For demonstration let us write a shell command to move selected file(s) to
trash.
A first attempt to write such a command may look like this: A first attempt to write such a command may look like this:
@@ -160,6 +158,18 @@ would simply work). This option is not set by default as things may behave
unexpectedly at other places. unexpectedly at other places.
File Operations
lf uses the underlying "cp" and "mv" shell commands for file operations. For
this purpose, when you "yank" (i.e. copy) a file, it doesn't actually copy
the file on the disk, but only records its name to memory. The actual file
operation takes place when you do the "paste" in which case the "cp" command
is used. Similarly the "mv" command is used for "delete" (i.e. cut or kill)
followed by "paste". These traditional names (e.g. "yank" and "delete") are
picked instead of the other common convention (e.g. copy and cut) to
resemble the default keybinds for these operations.
Opening Files Opening Files
You can use "open-file" command to open a file. This is a special command You can use "open-file" command to open a file. This is a special command
@@ -187,4 +197,5 @@ lf does not come bundled with a file opener. You can use any of the existing
file openers as you like. Possible options are "open" (for Mac OS X only), file openers as you like. Possible options are "open" (for Mac OS X only),
"xdg-utils" (executable name is "xdg-open"), "libfile-mimeinfo-perl" "xdg-utils" (executable name is "xdg-open"), "libfile-mimeinfo-perl"
(executable name is "mimeopen"), "rifle" (ranger's default file opener), or (executable name is "mimeopen"), "rifle" (ranger's default file opener), or
"mimeo" to name a few.` "mimeo" to name a few.
`
+13 -1
View File
@@ -6,4 +6,16 @@
# command line flag. Thus the same documentation is used for online and # command line flag. Thus the same documentation is used for online and
# terminal display. # terminal display.
echo "// DO NOT EDIT! (AUTO-GENERATED)\n\npackage main\n\nvar genDocString = \`$(go doc)\`" > docstring.go tmp=$(mktemp)
[ -f docstring.go ] && rm docstring.go
echo "// DO NOT EDIT! (AUTO-GENERATED)" >> $tmp
echo >> $tmp
echo "package main" >> $tmp
echo >> $tmp
echo "var genDocString = \`" >> $tmp
go doc | tr "\`" "'" >> $tmp
echo "\`" >> $tmp
mv $tmp docstring.go
+1 -1
View File
@@ -75,7 +75,7 @@ func main() {
flag.Parse() flag.Parse()
if *showDoc { if *showDoc {
fmt.Println(genDocString) fmt.Print(genDocString)
return return
} }