Prechádzať zdrojové kódy

cmd_shell: bash syntax highlighting for command line using pygments

Daniel-Constantin Mierla 5 rokov pred
rodič
commit
b3270f447c
1 zmenil súbory, kde vykonal 3 pridanie a 0 odobranie
  1. 3 0
      kamcli/commands/cmd_shell.py

+ 3 - 0
kamcli/commands/cmd_shell.py

@@ -36,6 +36,8 @@ from prompt_toolkit.shortcuts import prompt
 from prompt_toolkit.history import FileHistory
 from prompt_toolkit.history import FileHistory
 from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
 from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
 from prompt_toolkit.styles import Style
 from prompt_toolkit.styles import Style
+from prompt_toolkit.lexers import PygmentsLexer
+from pygments.lexers.shell import BashLexer
 import os
 import os
 import shlex
 import shlex
 import sys
 import sys
@@ -359,5 +361,6 @@ def cli(ctx, nohistory):
 
 
         prompt_kwargs = {
         prompt_kwargs = {
             "history": FileHistory(os.path.expanduser("~/.kamcli/history")),
             "history": FileHistory(os.path.expanduser("~/.kamcli/history")),
+            "lexer": PygmentsLexer(BashLexer),
         }
         }
         shell_repl(click.get_current_context(), prompt_kwargs=prompt_kwargs)
         shell_repl(click.get_current_context(), prompt_kwargs=prompt_kwargs)