Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Bug Fixes
Documentation
--------
* Add some links to `README.md` and format compatible servers with bullets.
* Squeeze inline `/help` table width down to 110 characters.


Internal
Expand Down
22 changes: 11 additions & 11 deletions mycli/client_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def register_special_commands(self) -> None:
self.manual_reconnect,
"connect",
"/connect [database]",
"Reconnect to the server, optionally switching databases.",
"Reconnect to server, optionally switching dbs.",
case_sensitive=True,
aliases=[SpecialCommandAlias("\\r", case_sensitive=True)],
completion_snippet='reconnect to server',
Expand All @@ -130,7 +130,7 @@ def register_special_commands(self) -> None:
self.rehash,
"rehash",
"/rehash",
"Refresh auto-completions.",
"Refresh completions.",
arg_type=ArgType.NO_ARGUMENT,
aliases=[SpecialCommandAlias("\\#", case_sensitive=False)],
completion_snippet='refresh completions',
Expand All @@ -139,42 +139,42 @@ def register_special_commands(self) -> None:
self.change_table_format,
"tableformat",
"/tableformat <format>",
"Change the table format used to output interactive results.",
"Set table format used for interactive results.",
case_sensitive=True,
aliases=[SpecialCommandAlias("\\T", case_sensitive=True)],
completion_snippet='change interactive output format',
completion_snippet='set interactive output format',
)
special.register_special_command(
self.change_redirect_format,
"redirectformat",
"/redirectformat <format>",
"Change the table format used to output redirected results.",
"Set table format used for redirected results.",
case_sensitive=True,
aliases=[SpecialCommandAlias("\\Tr", case_sensitive=True)],
completion_snippet='change redirected output format',
completion_snippet='set redirected output format',
)
special.register_special_command(
self.execute_from_file,
"source",
"/source [options] <file>",
"Execute queries from a file.",
"Execute queries from file.",
aliases=[SpecialCommandAlias("\\.", case_sensitive=False)],
completion_snippet='execute queries from file',
)
special.register_special_command(
self.change_prompt_format,
"prompt",
"/prompt [string]",
"Show or change prompt format.",
"Set or show prompt format.",
case_sensitive=True,
aliases=[SpecialCommandAlias("\\R", case_sensitive=True)],
completion_snippet='show or change prompt format',
completion_snippet='set prompt format',
)
special.register_special_command(
self.config_command,
r'\config',
'/config <help|get|search|edit> [key]',
'Inspect settings from config files.',
'/config <command> [key]',
'Inspect config file settings (/config help).',
completion_snippet='inspect config file settings',
)

Expand Down
4 changes: 2 additions & 2 deletions mycli/packages/special/dbcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def list_databases(cur: Cursor, **_) -> list[SQLResult]:
@special_command(
r'\ping',
'/ping',
'Check the connection.',
'Check connection.',
arg_type=ArgType.PARSED_QUERY,
completion_snippet='check connection',
)
Expand All @@ -101,7 +101,7 @@ def ping(cur: Cursor, arg: str | None = None, **_) -> list[SQLResult]:
@special_command(
"status",
"/status",
"Get status information from the server.",
"Get status information from server.",
arg_type=ArgType.RAW_QUERY,
case_sensitive=True,
aliases=[SpecialCommandAlias("\\s", case_sensitive=True)],
Expand Down
52 changes: 26 additions & 26 deletions mycli/packages/special/iocommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def disable_show_warnings() -> Generator[SQLResult, None, None]:
@special_command(
"pager",
"/pager [command]",
"Set pager to [command]. Print query results via pager.",
"Set pager to [command]; print results via pager.",
arg_type=ArgType.PARSED_QUERY,
case_sensitive=True,
aliases=[SpecialCommandAlias("\\P", case_sensitive=True)],
Expand Down Expand Up @@ -181,7 +181,7 @@ def disable_pager() -> list[SQLResult]:
@special_command(
"\\timing",
"/timing",
"Toggle timing of queries.",
"Toggle query timing.",
arg_type=ArgType.NO_ARGUMENT,
case_sensitive=True,
aliases=[SpecialCommandAlias("\\t", case_sensitive=True)],
Expand Down Expand Up @@ -358,7 +358,7 @@ def set_redirect(command_part: str | None, file_operator_part: str | None, file_
@special_command(
r'\favorite',
'/favorite <command>',
'Alternative favorite query interface. See /favorite help.',
'Manage favorite queries (/favorite help).',
arg_type=ArgType.PARSED_QUERY,
case_sensitive=False,
completion_snippet='manage favorite queries',
Expand Down Expand Up @@ -413,8 +413,8 @@ def favorite(arg: str, cur: Cursor | None = None, **_) -> Iterable[SQLResult]:

@special_command(
"\\f",
"/f [name [args..] [--key=value]]",
"List or execute favorite queries.",
"/f [name [args] [--key=val]]",
"Run favorite query shortcut.",
arg_type=ArgType.PARSED_QUERY,
case_sensitive=True,
completion_snippet='list or run favorite queries',
Expand Down Expand Up @@ -588,8 +588,8 @@ def subst_favorite_query_args(query: str, args: list[str]) -> list[str | None]:
@special_command(
"\\fs",
"/fs <name> <query>",
"Save a favorite query.",
completion_snippet='save favorite queries',
"Save favorite query shortcut.",
completion_snippet='save favorite query',
)
def save_favorite_query(arg: str, **_) -> list[SQLResult]:
"""Save a new favorite query."""
Expand Down Expand Up @@ -643,8 +643,8 @@ def is_favorite_save_command(statement: str) -> bool:
@special_command(
"\\fd",
"/fd <name>",
"Delete a favorite query.",
completion_snippet='delete favorite queries',
"Delete favorite query shortcut.",
completion_snippet='delete favorite query',
)
def delete_favorite_query(arg: str, **_) -> list[SQLResult]:
"""Delete an existing favorite query."""
Expand All @@ -663,8 +663,8 @@ def _delete_favorite_query(arg: str, usage: str) -> list[SQLResult]:

@special_command(
r'\dsn',
'/dsn <help|list|show|save|edit|delete>',
'Manage saved DSNs. See /dsn help.',
'/dsn <command>',
'Manage saved DSNs (/dsn help).',
arg_type=ArgType.PARSED_QUERY,
case_sensitive=False,
completion_snippet='manage saved DSNs',
Expand Down Expand Up @@ -743,8 +743,8 @@ def _edit_dsn_alias(alias: str) -> list[SQLResult]:
@special_command(
"system",
"/system [-r] <command>",
"Execute a system shell command (raw mode with -r).",
completion_snippet='execute system command',
"Execute shell command (-r for raw mode).",
completion_snippet='execute shell command',
)
def execute_system_command(arg: str, **_) -> list[SQLResult]:
"""Execute a system shell command."""
Expand Down Expand Up @@ -826,7 +826,7 @@ def parseargfile(arg: str) -> tuple[str, str]:
@special_command(
"tee",
"/tee [-o] <file>",
"Append all results to an output file (overwrite using -o).",
"Append all results to file (-o to overwrite).",
completion_snippet='append all results to file',
)
def set_tee(arg: str, **_) -> list[SQLResult]:
Expand All @@ -850,7 +850,7 @@ def close_tee() -> None:
@special_command(
"notee",
"/notee",
"Stop writing results to an output file.",
"Stop writing all results to tee file.",
completion_snippet='stop writing to tee file',
)
def no_tee(arg: str, **_) -> list[SQLResult]:
Expand All @@ -871,9 +871,9 @@ def write_tee(output: str | ANSI | FormattedText, nl: bool = True) -> None:
@special_command(
"\\once",
"/once [-o] <file>",
"Append next result to an output file (overwrite using -o).",
"Append next result to a file (-o to overwrite).",
aliases=[SpecialCommandAlias("\\o", case_sensitive=False)],
completion_snippet='append one result to file',
completion_snippet='append next result to file',
)
def set_once(arg: str, **_) -> list[SQLResult]:
global once_file, written_to_once_file
Expand Down Expand Up @@ -935,9 +935,9 @@ def _run_post_redirect_hook(post_redirect_command: str, filename: str) -> None:
@special_command(
"\\pipe_once",
"/pipe_once <command>",
"Send next result to a subprocess.",
"Send next result to subprocess.",
aliases=[SpecialCommandAlias("\\|", case_sensitive=False)],
completion_snippet='send one result to subprocess',
completion_snippet='next result to subprocess',
)
def set_pipe_once(arg: str, **_) -> list[SQLResult]:
if not arg:
Expand Down Expand Up @@ -999,14 +999,14 @@ def flush_pipe_once_if_written(post_redirect_command: str) -> None:

@special_command(
"watch",
"/watch [seconds] [-c] <query>",
"Execute query every [seconds] seconds (5 by default).",
"/watch [sec] [-c] <query>",
"Execute query every [sec] seconds (default 5).",
completion_snippet='run query every N seconds',
)
def watch_query(arg: str, **kwargs) -> Generator[SQLResult, None, None]:
usage = """Syntax: watch [seconds] [-c] query.
* seconds: The interval at the query will be repeated, in seconds.
By default 5.
usage = """Syntax: watch [sec] [-c] query.
* sec: The interval at the query will be repeated, in seconds.
By default: 5.
* -c: Clears the screen between every iteration.
"""
if not arg:
Expand Down Expand Up @@ -1072,8 +1072,8 @@ def watch_query(arg: str, **kwargs) -> Generator[SQLResult, None, None]:
@special_command(
"delimiter",
"/delimiter <string>",
"Change end-of-statement delimiter.",
completion_snippet='change end-of-statement delimiter',
"Set end-of-statement delimiter.",
completion_snippet='set end-of-statement delimiter',
)
def set_delimiter(arg: str, **_) -> list[SQLResult]:
return delimiter_command.set(arg)
Expand Down
22 changes: 11 additions & 11 deletions mycli/packages/special/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ def execute(cur: Cursor, sql: str) -> list[SQLResult]:
@special_command(
"help",
"/help [term]",
"Show this table, or search for help on a term.",
"Show this table, or search for help on term.",
arg_type=ArgType.NO_ARGUMENT,
aliases=[SpecialCommandAlias("\\?", case_sensitive=False), SpecialCommandAlias("?", case_sensitive=False)],
completion_snippet='show help or search',
)
def show_help(*_args) -> list[SQLResult]:
header = ["Command", "Shortcut", "Usage", "Description"]
header = ["Command", "Alias", "Usage", "Description"]
result = []

for _, value in sorted(COMMANDS.items(), key=lambda x: str.casefold(x[0].removeprefix('\\').removeprefix('/'))):
Expand Down Expand Up @@ -300,9 +300,9 @@ def show_keyword_help(cur: Cursor, arg: str) -> list[SQLResult]:
@special_command(
'\\bug',
'/bug',
'File a bug on GitHub.',
'File bug on GitHub.',
arg_type=ArgType.NO_ARGUMENT,
completion_snippet='file a bug on GitHub',
completion_snippet='file bug on GitHub',
)
def file_bug(*_args) -> list[SQLResult]:
webbrowser.open_new_tab(ISSUES_URL)
Expand Down Expand Up @@ -332,7 +332,7 @@ def quit_(*_args):
@special_command(
"\\edit",
"/edit <file> | <query>\\edit",
"Edit query with editor (uses $VISUAL or $EDITOR).",
"Edit query with editor (via $VISUAL/$EDITOR).",
arg_type=ArgType.NO_ARGUMENT,
case_sensitive=True,
aliases=[SpecialCommandAlias("\\e", case_sensitive=True)],
Expand All @@ -341,31 +341,31 @@ def quit_(*_args):
@special_command(
"\\clip",
"/clip | <query>\\clip",
"Copy query to the system clipboard.",
"Copy query to system clipboard.",
arg_type=ArgType.NO_ARGUMENT,
case_sensitive=True,
completion_snippet='copy query to clipboard',
)
@special_command(
"\\G",
"<query>\\G",
"Display query results vertically.",
"Display results vertically.",
arg_type=ArgType.NO_ARGUMENT,
case_sensitive=True,
backslash_only=True,
)
@special_command(
"\\g",
"<query>\\g",
"Display query results (mnemonic: go).",
"Display results (mnemonic: go).",
arg_type=ArgType.NO_ARGUMENT,
case_sensitive=True,
backslash_only=True,
)
@special_command(
"\\x",
"<query>\\x",
"Display query results in an explorer rather than a pager.",
"Display results in an interactive explorer.",
arg_type=ArgType.NO_ARGUMENT,
case_sensitive=True,
backslash_only=True,
Expand All @@ -379,11 +379,11 @@ def stub():
@special_command(
"\\llm",
"/llm [arguments]",
"Interrogate an LLM. See \"/llm help\".",
"Interrogate LLM (/llm help).",
arg_type=ArgType.RAW_QUERY,
case_sensitive=True,
aliases=[SpecialCommandAlias("\\ai", case_sensitive=True)],
completion_snippet='interrogate an LLM',
completion_snippet='interrogate LLM',
)
def llm_stub():
raise NotImplementedError
Loading
Loading