Public » Mercurial » hg-lisppaste
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

adds a interactive comand line option.

Now -i will cause it to prompt for settings even if they are already set in hgrc.

Changeset d3761377682f

Parent b4994d4cc1f7

by Stefan Rusek

Changes to one file · Browse files at d3761377682f Showing diff from parent b4994d4cc1f7 Diff from another changeset...

Change 1 of 2 Show Entire File lisppaste.py Stacked
 
35
36
37
38
39
40
41
 
 
 
 
 
 
 
 
 
 
 
42
43
44
 
58
59
60
 
61
62
63
 
35
36
37
 
 
 
 
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
65
66
67
68
69
70
71
@@ -35,10 +35,17 @@
 from mercurial import commands, cmdutil, patch, ui, util  from mercurial.i18n import _   -def paste(ui, repo, nick, channel, title, **opts): - nick = nick or ui.config('lisppaste', 'nick') or ui.prompt('nick:', default='') - channel = channel or ui.config('lisppaste', 'channel') or ui.prompt('channel:', default='') - title = title or ui.prompt('title:', default='') +def paste(ui, repo, interactive, **opts): + def prompt(name, default): + if not opts.get(name) and interactive or not default: + msg = (default and '%s [%s]:' or '%s%s:') % (name, default) + return ui.prompt(msg, default=default) + return default + + nick = prompt('nick', opts.get('nick') or ui.config('lisppaste', 'nick')) + channel = prompt('channel', opts.get('channel') or ui.config('lisppaste', 'channel')) + title = prompt('title', opts.get('title')) +   if not nick or not channel or not title:   raise util.Abort('must specify nick, channel, and title')   rev = opts.get('rev') @@ -58,6 +65,7 @@
  [('N', 'nick', '', _('your nickname on Freenode')),   ('C', 'channel', '', _('the channel to associate with the paste')),   ('m', 'title', '', _('title for the paste')), + ('i', 'interactive', False, _('forces prompting for options')),   ] + commands.diffopts + commands.diffopts2 + commands.walkopts,   _('hg paste [OPTION]')),   }