Skip to content
Open
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 @@ -8,6 +8,7 @@ Features
* Add `llm help` subcommand.
* Rewrite `help` table.
* Remove "info" counter from fzf history-search UI.
* Add `\bug` command.


Bug Fixes
Expand Down
2 changes: 2 additions & 0 deletions mycli/TIPS
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ use "system <command>" to execute a shell command!

the "watch" command executes a query every N seconds!

use \bug to file a bug on GitHub!

###
### general
###
Expand Down
1 change: 1 addition & 0 deletions mycli/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISSUES_URL = 'https://github.com/dbcli/mycli/issues'
3 changes: 2 additions & 1 deletion mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from mycli.compat import WIN
from mycli.completion_refresher import CompletionRefresher
from mycli.config import get_mylogin_cnf_path, open_mylogin_cnf, read_config_files, str_to_bool, strip_matching_quotes, write_default_config
from mycli.constants import ISSUES_URL
from mycli.key_bindings import mycli_bindings
from mycli.lexer import MyCliLexer
from mycli.packages import special
Expand Down Expand Up @@ -86,7 +87,7 @@
# Query tuples are used for maintaining history
Query = namedtuple("Query", ["query", "successful", "mutating"])

SUPPORT_INFO = "Home: https://mycli.net\nBug tracker: https://github.com/dbcli/mycli/issues"
SUPPORT_INFO = f"Home: https://mycli.net\nBug tracker: {ISSUES_URL}"
DEFAULT_WIDTH = 80
DEFAULT_HEIGHT = 25
MIN_COMPLETION_TRIGGER = 1
Expand Down
8 changes: 8 additions & 0 deletions mycli/packages/special/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import logging
import os
from typing import Callable
import webbrowser

from mycli.constants import ISSUES_URL
from mycli.packages.sqlresult import SQLResult

try:
Expand Down Expand Up @@ -186,6 +188,12 @@ def show_keyword_help(cur: Cursor, arg: str) -> list[SQLResult]:
return [SQLResult(status=f'No help found for {keyword}.')]


@special_command('\\bug', '\\bug', 'File a bug on GitHub.', arg_type=ArgType.NO_QUERY)
def file_bug(*_args) -> list[SQLResult]:
webbrowser.open_new_tab(ISSUES_URL)
return [SQLResult(status=f'{ISSUES_URL} — press "New Issue"')]


@special_command("exit", "exit", "Exit.", arg_type=ArgType.NO_QUERY, aliases=["\\q"])
@special_command("quit", "quit", "Quit.", arg_type=ArgType.NO_QUERY, aliases=["\\q"])
def quit_(*_args):
Expand Down
1 change: 1 addition & 0 deletions test/features/fixture_data/help_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
| Command | Shortcut | Usage | Description |
+----------------+----------+------------------------------+-------------------------------------------------------------+
| \G | <nope> | <query>\G | Display query results vertically. |
| \bug | <nope> | \bug | File a bug on GitHub. |
| \clip | <nope> | <query>\clip | Copy query to the system clipboard. |
| \dt | <nope> | \dt[+] [table] | List or describe tables. |
| \e | <nope> | <query>\e | \e <filename> | Edit query with editor (uses $EDITOR). |
Expand Down