Skip to content

Commit b7d3f54

Browse files
committed
Add pastebin confirmation configuration. This defaults to have confirmation but when the pastebin_confirm option under the general section is set to false you wont have to verify. It also includes an option pastebin_private under the general section. This will allow people to paste private in the future.
1 parent 6628721 commit b7d3f54

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

bpython/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def loadini(struct, configfile):
4545
'paste_time': 0.02,
4646
'syntax': True,
4747
'tab_length': 4,
48+
'pastebin_confirm': True,
49+
'pastebin_private': False,
4850
'pastebin_url': 'http://bpaste.net/xmlrpc/',
4951
'pastebin_show_url': 'http://bpaste.net/show/$paste_id/',
5052
},
@@ -92,6 +94,8 @@ def loadini(struct, configfile):
9294
struct.exit_key = config.get('keyboard', 'exit')
9395
struct.last_output_key = config.get('keyboard', 'last_output')
9496

97+
struct.pastebin_confirm = config.getboolean('general', 'pastebin_confirm')
98+
struct.pastebin_private = config.getboolean('general', 'pastebin_private')
9599
struct.pastebin_url = config.get('general', 'pastebin_url')
96100
struct.pastebin_show_url = config.get('general', 'pastebin_show_url')
97101

bpython/repl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,10 @@ def write2file(self):
625625
def pastebin(self):
626626
"""Upload to a pastebin and display the URL in the status bar."""
627627

628-
if not self.statusbar.prompt("Pastebin buffer? (y/N) "
628+
if (self.config.pastebin_confirm and
629+
not self.statusbar.prompt("Pastebin buffer? (y/N) "
629630
).lower().startswith('y'
630-
):
631+
)):
631632
self.statusbar.message("Pastebin aborted")
632633
return
633634

0 commit comments

Comments
 (0)