~kelemeng/software-properties/bug945245

« back to all changes in this revision

Viewing changes to add-apt-repository

  • Committer: Michael Vogt
  • Date: 2011-08-19 07:13:44 UTC
  • mfrom: (715.1.1 software-properties)
  • Revision ID: michael.vogt@ubuntu.com-20110819071344-44owe8u5kvd8lspz
* lp:~gandelman-a/software-properties/lp829109 :
  - add "-y" to add-apt-repository (LP: #829109). This can be
    used to avoid the confirmation prompt. Alternatively you
    can redirect stdin to /dev/null for skipping of the confirmation

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    parser.add_option("-k", "--keyserver",
51
51
        dest="keyserver", default=DEFAULT_KEYSERVER,
52
52
        help="URL of keyserver. Default: %default")
 
53
    parser.add_option("-y", "--yes", action="store_true",
 
54
        dest="assume_yes", default=False,
 
55
        help="Assume yes to all queries")
53
56
    (options, args) = parser.parse_args()
54
57
 
55
58
    if os.geteuid() != 0:
67
70
    line = args[0]
68
71
 
69
72
    # display PPA info (if needed)
70
 
    if line.startswith("ppa:"):
 
73
    if line.startswith("ppa:") and not options.assume_yes:
71
74
        from softwareproperties.ppa import get_ppa_info_from_lp
72
75
        user, sep, ppa_name = line.split(":")[1].partition("/")
73
76
        ppa_name = ppa_name or "ppa"
79
82
        if sys.stdin.isatty():
80
83
            print _("Press [ENTER] to continue or ctrl-c to cancel adding it")
81
84
            sys.stdin.readline()
82
 
    
83
85
 
84
86
    # add it
85
87
    sp = SoftwareProperties(options=options)