1
0
mirror of https://github.com/httpie/cli.git synced 2025-06-27 00:51:16 +02:00

Implement support for bash & completion flow generation

This commit is contained in:
Batuhan Taskaya
2022-05-20 10:42:38 +03:00
parent b8e0be241c
commit ee5fc59c51
9 changed files with 218 additions and 54 deletions

View File

@ -1,18 +1,17 @@
from atexit import register
import functools
import string
import textwrap
from jinja2 import Template
from atexit import register
from pathlib import Path
from typing import Any, Dict, Callable, TypeVar
from typing import Any, Callable, Dict, TypeVar
from completion_flow import generate_flow
from jinja2 import Template
from httpie.cli.constants import SEPARATOR_FILE_UPLOAD
from httpie.cli.definition import options
from httpie.cli.options import Argument, ParserSpec
from completion_flow import generate_flow
T = TypeVar('T')
EXTRAS_DIR = Path(__file__).parent.parent.parent
@ -202,7 +201,7 @@ def zsh_completer(spec: ParserSpec) -> Dict[str, Any]:
return {
'escape_zsh': escape_zsh,
'serialize_argument_to_zsh': serialize_argument_to_zsh,
'compile_zsh': compile_zsh
'compile_zsh': compile_zsh,
}
@ -213,6 +212,15 @@ def fish_completer(spec: ParserSpec) -> Dict[str, Any]:
}
@use_template('bash')
def fish_completer(spec: ParserSpec) -> Dict[str, Any]:
from bash import compile_bash
return {
'compile_bash': compile_bash,
}
def main():
for shell_type, completer in COMPLETERS.items():
print(f'Generating {shell_type} completer.')