Initial upload: shell-history-semantic-search v0.1.0
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-03-22 18:15:38 +00:00
parent e75ef3deea
commit 0c0546c082

View File

@@ -0,0 +1,28 @@
from typing import Type
from shell_history_search.parsers.bash import BashHistoryParser
from shell_history_search.parsers.zsh import ZshHistoryParser
from shell_history_search.parsers.fish import FishHistoryParser
from shell_history_search.parsers import HistoryParser
def get_parser(shell_type: str) -> HistoryParser:
parsers: dict[str, Type[HistoryParser]] = {
"bash": BashHistoryParser,
"zsh": ZshHistoryParser,
"fish": FishHistoryParser,
}
parser_class = parsers.get(shell_type.lower())
if parser_class is None:
raise ValueError(f"Unknown shell type: {shell_type}")
return parser_class()
def get_all_parsers() -> list[HistoryParser]:
return [
BashHistoryParser(),
ZshHistoryParser(),
FishHistoryParser(),
]