Start work on porting diff kitten

This commit is contained in:
Kovid Goyal 2023-03-15 15:32:55 +05:30
parent cb03168957
commit 44ff6bd1dd
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 27 additions and 3 deletions

View File

@ -708,6 +708,7 @@ elif __name__ == '__doc__':
cd['usage'] = usage cd['usage'] = usage
cd['options'] = OPTIONS cd['options'] = OPTIONS
cd['help_text'] = help_text cd['help_text'] = help_text
cd['short_desc'] = 'Pretty, side-by-side diffing of files and images'
cd['args_completion'] = CompletionSpec.from_string('type:file mime:text/* mime:image/* group:"Text and image files"') cd['args_completion'] = CompletionSpec.from_string('type:file mime:text/* mime:image/* group:"Text and image files"')
elif __name__ == '__conf__': elif __name__ == '__conf__':
from .options.definition import definition from .options.definition import definition

View File

@ -21,10 +21,11 @@ mma = definition.add_mouse_map
agr('diff', 'Diffing') agr('diff', 'Diffing')
opt('syntax_aliases', 'pyj:py pyi:py recipe:py', opt('syntax_aliases', 'pyj:py pyi:py recipe:py',
option_type='syntax_aliases', option_type='syntax_aliases', ctype='strdict_ _:',
long_text=''' long_text='''
File extension aliases for syntax highlight. For example, to syntax highlight File extension aliases for syntax highlight. For example, to syntax highlight
:file:`file.xyz` as :file:`file.abc` use a setting of :code:`xyz:abc`. :file:`file.xyz` as :file:`file.abc` use a setting of :code:`xyz:abc`.
Multiple aliases must be separated by spaces.
''' '''
) )
@ -47,7 +48,7 @@ opt('replace_tab_by', '\\x20\\x20\\x20\\x20',
long_text='The string to replace tabs with. Default is to use four spaces.' long_text='The string to replace tabs with. Default is to use four spaces.'
) )
opt('+ignore_name', '', opt('+ignore_name', '', ctype='string',
option_type='store_multiple', option_type='store_multiple',
add_to_default=False, add_to_default=False,
long_text=''' long_text='''

View File

@ -24,7 +24,7 @@ exec_kitty() {
is_wrapped_kitten() { is_wrapped_kitten() {
wrapped_kittens="clipboard icat hyperlinked_grep ask hints unicode_input ssh themes" wrapped_kittens="clipboard icat hyperlinked_grep ask hints unicode_input ssh themes diff"
[ -n "$1" ] && { [ -n "$1" ] && {
case " $wrapped_kittens " in case " $wrapped_kittens " in
*" $1 "*) printf "%s" "$1" ;; *" $1 "*) printf "%s" "$1" ;;

19
tools/cmd/diff/main.go Normal file
View File

@ -0,0 +1,19 @@
// License: GPLv3 Copyright: 2023, Kovid Goyal, <kovid at kovidgoyal.net>
package diff
import (
"fmt"
"kitty/tools/cli"
)
var _ = fmt.Print
func main(_ *cli.Command, opts *Options, args []string) (rc int, err error) {
return
}
func EntryPoint(parent *cli.Command) {
create_cmd(parent, main)
}

View File

@ -9,6 +9,7 @@ import (
"kitty/tools/cmd/ask" "kitty/tools/cmd/ask"
"kitty/tools/cmd/at" "kitty/tools/cmd/at"
"kitty/tools/cmd/clipboard" "kitty/tools/cmd/clipboard"
"kitty/tools/cmd/diff"
"kitty/tools/cmd/edit_in_kitty" "kitty/tools/cmd/edit_in_kitty"
"kitty/tools/cmd/hints" "kitty/tools/cmd/hints"
"kitty/tools/cmd/hyperlinked_grep" "kitty/tools/cmd/hyperlinked_grep"
@ -46,6 +47,8 @@ func KittyToolEntryPoints(root *cli.Command) {
ask.EntryPoint(root) ask.EntryPoint(root)
// hints // hints
hints.EntryPoint(root) hints.EntryPoint(root)
// hints
diff.EntryPoint(root)
// themes // themes
themes.EntryPoint(root) themes.EntryPoint(root)
// __pytest__ // __pytest__