1
0
Fork 0
Commit Graph

76 Commits

Author SHA1 Message Date
astroshot c0e1081405
Feature: Add new formatter to export data to sql like mycli (#1366)
* Sub: Add new formatter to export data to sql like mycli

Body: New formatter is added, we can export query result to sql
insertion like mycli

==== End ====

* Sub: Install black and reformat code

Body:

==== End ====

* Sub: Add unit tests for new formatter

Body:

==== End ====

* Sub: Add new formatter to pgclirc
2022-09-14 17:41:40 -07:00
Irina Truong c65495716d
Add setting in config to control truncating field values. (#1285)
* Add setting in config to truncate field value.

* Black.

* Changelog.

* Fix tests.
2021-09-03 16:58:03 -07:00
Irina Truong a3287c4ab2
Finer control over destructive warning. (#1242)
* Finer control over destructive warning.

* Review feedback.

* Changelog.

* Run integration tests with --warn=moderate.

* Fix typo.

* Black.
2021-02-12 21:09:38 -08:00
Eero Ruohola 87ffae295e
Fix issue where `syntax_style` config value would not have any effect (#1241)
These config properties got introduced in 41dd24e8 as a means to have
more granular control over the syntax highlighting. The problem is that
these cannot be in the default config file since `get_config()` always
reads both the default config file and the user specified one, and there
is no way to unset these variables in the user specified config file to
restore their default behavior. Even if there would be a way, it
wouldn't be intuitive at all to be required to unset some random
settings under the `[colors]` section just to be able to use the well
documented `syntax_style` setting.

Note that one *can* still set these three lines in their user config
file if they want to utilize them.

Resolves #1212
2021-02-10 15:06:19 -08:00
Sky.G.Uieen 41dd24e8da
Add custom color (#1196)
* Updated author, changelog for supporting color of string, number, keyword

* Added string, number, keyword custom color
2020-07-07 20:19:22 -07:00
laixintao 0c24e8bda2
Support style for missing value. (#1186)
* Support style for missing value.

* update changelog.

* upgrade minimal version of cli_helpers, in order to use style for null.
2020-05-28 15:29:50 -07:00
anthonydb a9ef523eb3 Minor typo fixes in pgclirc 2020-05-26 09:08:14 -04:00
Stephano Paraskeva 936475258d
show_bottom_toolbar - Feature to Show/Hide Toolbar (#1170)
* adds ternary to decide whether bottom_toolbar is shown based on config value

* runs black format

* adds name to authors

* modifies changelog.rst

* removes change in changelog.rst

* formats config

* removes unused variable, adds change to changelog

* changes default back to true

* removed reference to var
2020-04-17 22:58:13 -07:00
Amjith Ramanujam 2a28399c3f
Add an example for how to use the colored prompt. (#1163) 2020-03-30 09:32:00 +08:00
Jonas Jelten 36605174a4 support ansi escape sequences for prompt colors 2019-11-25 22:51:15 +01:00
Irina Truong b2ebe0e95c
Issue 1018 display first 1k rows (#1092)
* Added changes to remove the prompt on >1000 rows queries

* Reformatted with black

* Changed comment on row_limit parameter

* Added contribution to changelog and name to AUTHORS

* Refactored test to reflect new functionality

* Removed argument

* Removed debug echo statement

* Reformatted with black

* Added changes to remove the prompt on >1000 rows queries

* Reformatted with black

* Changed comment on row_limit parameter

* Added contribution to changelog and name to AUTHORS

* Refactored test to reflect new functionality

* Removed argument

* Removed debug echo statement

* Reformatted with black

* Added missing issue numbers in changelog

* Reformatted code using black
2019-08-23 13:44:36 -07:00
Amjith Ramanujam 83e17e825f Remove the expand_tab option from pgclirc. 2019-03-16 14:09:39 -07:00
Artur Balabanov f897ea466e Merge branch 'master' into tab-on-line-start 2018-10-01 10:25:13 +01:00
Irina Truong 392491a74d
Cherry-picked prompt-toolkit 2.0 changes. (#930)
* Cherry-picked prompt-toolkit 2.0 changes.

* Increase help timeout.

* Missed one.

* Fixes editor command.

* Expect exact to fix named query error.

* Unicode is non-optional with ptk 2.0.

* Unicode literals all the things (almost).

* PEP8.

* Change how we swap completers.

* By default, bottom toolbar styles are reversed. We don't want that.

* Adapt styles to 2.0.

* The future is now. Switch to ptk 2.0 style names.

* PEP8.

* Flag for enable_open_in_editor.

* add class:prompt to prompt

* Removed workaround for #668. Some renaming.

* use pgcli.completer instead of app.current_buffer.completer

* enable_system_prompt=True like old prompt toolkit

* keep search_ignore_case enabled (was ignore_case)

* fix closing parenthese

* keep marking class:continuation token for continuation

* capture KeyboardInterrupt manually

AbortAction has been removed in Prompt_toolkit 2.0

* replace C-J with enter, add more comments

* reversed ([...]) to [(...)] (oops)

* pep8 fixes

* Does Vi mode have to be applied to session every time?

* (workaround) also enable vi_mode after edit command

* Fixed test errors after rebasing on master.
2018-09-28 14:18:40 -07:00
Artur Balabanov 676b5e6ff6 Add a config option -- expand_tab. If set, \t character will be replaced by 4 spaces when a <Tab> key is pressed on an empty line 2018-07-27 17:07:18 +01:00
Dick Marinus 868b81aa98 make keyring optional 2018-07-22 07:34:56 +02:00
Dan Clark 8fce953a8c ported the desctructive warning from mycli 2018-05-17 05:54:50 -04:00
Irina Truong dd0c721ad5 Merged master into branch. 2018-03-31 13:09:23 -07:00
Andrew Kuchling d0e68d0617 #858: fix comment in pgclirc 2018-03-28 16:27:41 -04:00
fraoustin 344317df34 explicit sample in pgclirc 2018-03-23 23:24:35 +01:00
fraoustin ade6142ef8 add color for table 2018-03-04 11:05:50 +01:00
fraoustin 64a683cae7
Update pgclirc 2018-01-17 12:48:36 +01:00
fraoustin 57cc451f06 manage pset pager 2018-01-06 11:58:59 +01:00
Chris Vaughn cc4854214e correct typo in pgclirc comment 2017-12-23 07:07:01 -06:00
Marcin Sztolcman 54f0b7f02c removed setting prompt_dsn from config, just allow for it in cli options 2017-12-11 04:48:24 +01:00
Marcin Sztolcman e4ec94a4c2 typos 2017-12-11 04:24:55 +01:00
Marcin Sztolcman ba4836652e use other prompt when connecting using --dsn parameter 2017-12-11 04:24:43 +01:00
Thomas Roten 70db642c4b Add null_string to config file. 2017-08-09 12:53:42 -05:00
Amjith Ramanujam 1301b7ad7b Change the continuation char to empty string. 2017-07-24 10:32:37 -07:00
Amjith Ramanujam 2c80a8c98f Change the casing default to 'auto'. 2017-07-16 20:26:43 -07:00
Thomas Roten 61f0d63013 Initial work on using CLI Helpers. 2017-06-11 21:07:40 -05:00
Amjith Ramanujam edf40d052b Merge branch 'master' into koljonen/case_column_titles 2017-04-21 07:38:14 -07:00
Owen Stephens e5d3d5d63f Allow configurable multiline continuation char 2017-03-30 11:12:25 +01:00
Joakim Koljonen 49ba6b4001
Casing for column headers (based on casing file)
```
koljonen@localhost:koljonen> SELECT transferid, parenttransferid, amount from transfers
╒══════════════╤════════════════════╤══════════╕
│ TransferID   │ ParentTransferID   │ Amount   │
╞══════════════╪════════════════════╪══════════╡
...
...
...
```
2017-03-18 18:51:56 +01:00
Joakim Koljonen bdf2a0e26a
Start suggesting tables/functions/views/types not in search_path
And schema-qualifying them, of course, so that for `SELECT * FROM bar`
we might suggest `buildings.barns` and for `select dopi` we might
suggest `maintenance.delete_old_personal_info()`, for example.

Controlled by a config setting, `search_path_filter`, in case anyone
prefers the old behaviour.
2017-03-05 02:21:31 +01:00
Darik Gamble fe44cd4b37 Add a config option for the number of menu lines to reserve 2017-02-25 09:18:54 -05:00
AGhost-7 81aad79cab Per #298, make expand modes configurable.
This makes it possible to enable through the configuration the always
expand and automatic expansion modes in pgcli.
2017-01-21 12:51:12 -05:00
Amjith Ramanujam 17d3f05d56 Set default data_formatting to nothing. 2017-01-06 09:47:32 -08:00
Irina Truong 4edd124c0d Merge pull request #621 from dbcli/koljonen/show_transaction_status
Add transaction status to toolbar
2016-12-12 15:06:51 -08:00
Joakim Koljonen 466b8e74be
Better status-bar transaction-status colors 2016-12-10 05:13:29 +01:00
Joakim Koljonen f8b1647ae8
Add transaction status to toolbar 2016-12-07 04:39:03 +01:00
koljonen 45326335e6
Support for table-qualifying column suggestions
... i.e. suggesting foo.fooid instead of just fooid
Controlled using a config-file setting:
**qualify_columns**: always/never/**if_more_than_one_table**.

To enable the proper sorting of qualified column suggestions, we
introduce the concept of synonyms for suggestions
(in `pgcompleter.find_matches`). They way synonyms work is that a
number of synonyms may be provided for a suggestion sent to
`find_matches`. If synonyms are provided, sorting is based on how
well the best synonym matches the input, instead of only comparing
the input to the suggestion text.
In this case, the unqualified name acts as a synonym.
I have a couple of other ideas of use cases where we can use synonyms
to get better completions with less typing for the user, which I intend
to explore later.
2016-12-05 03:15:53 +01:00
Lele Gaifax 9584c82a35 Fix typo in the decimal representation example 2016-10-17 20:27:29 +02:00
Foxygrandpa 0ef94c984b master: decimal and float format in config file 2016-09-27 13:43:28 +03:00
Joakim Koljonen 99868bbc31
Option for semicolon not to trigger execution in multiline mode
New setting multi_line_mode (default "psql"). If set to "safe",
[Esc] [Enter] or [Alt]-[Enter] is required to execute a query.
2016-09-12 22:28:32 +02:00
Darik Gamble f506dfbcaa Support configuring keyword casing preferences 2016-09-04 08:41:15 -04:00
Lim H 8c54ae76b4 Make prompt format configurable
Port logic from https://github.com/dbcli/mycli/blob/master/mycli/myclirc#L53-L60
2016-07-15 23:28:02 +01:00
koljonen e15b3ec0a1
Suggest table aliases + add tests for casing
If config.main.generate_aliases is True, for `SELECT * FROM `, we suggest `FooBar FB` and `foo_bar fb` instead of `FooBar` and `foo_bar`, respectively.
To be able to add a test, I had to add support for testing with different settings, which meant I could also add tests for casing.

There are two non-obvious changes that I can think of:
1. The lexical sorting of matches is modified so as to sort spaces and underscores before letters and to sort case-insensitively. This is so that e.g `Foob F` comes before 'FooBar FB' when `foob` is input.
2. We now suggest `some_func()` instead of `some_func` (because suggesting `some_func sf` didn't make any sense).
2016-06-27 21:26:59 +02:00
Irina Truong abfc979386 Ported less_chatty option from mycli. 2016-06-19 14:16:11 -07:00
darikg 92cc469b7b Merge pull request #512 from koljonen/casing
Custom casing of table/column/function/view names
2016-06-06 17:21:32 -04:00