From 9cb089433773df15733c3ea39f890815089d1661 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 27 May 2007 15:17:05 +0000 Subject: [PATCH] Added --create, which suppresses the 'do you want to create this file' question and the editor invocation (Justus Winter). Add the extension .xml to temporary files to be opened with $EDITOR to help $EDITOR guess the filetype (Justus Winter). git-svn-id: file:///home/talex/Backups/sf.net/Subversion/zero-install/trunk/0publish@1782 9f8c893c-44ee-0310-b757-c8ca8341c71e --- 0publish | 7 ++++--- edit.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/0publish b/0publish index 0e56365..0eba945 100755 --- a/0publish +++ b/0publish @@ -15,6 +15,7 @@ parser.add_option("--add-version", help="add a new implementation", action='stor parser.add_option("--archive-url", help="add archive at this URL", action='store', metavar='URL') parser.add_option("--archive-file", help="local copy of archive-url", action='store', metavar='FILE') parser.add_option("--archive-extract", help="subdirectory of archive to extract", action='store', metavar='DIR') +parser.add_option("-c", "--create", help="create file if nonexistant", action='store_true') parser.add_option("-e", "--edit", help="edit with $EDITOR", action='store_true') parser.add_option("-g", "--gpgsign", help="add a GPG signature block", action='store_true') parser.add_option("-k", "--key", help="key to use for signing") @@ -35,7 +36,7 @@ parser.add_option("-V", "--version", help="display version information", action= (options, args) = parser.parse_args() -force_save = False +force_save = options.create if options.version: print "0publish (zero-install) " + version @@ -82,11 +83,11 @@ try: else: raise Exception("File '%s' does not exist." % options.local) else: - if confirm("Interface file '%s' does not exist. Create it?" % interface): + if options.create or confirm("Interface file '%s' does not exist. Create it?" % interface): data = create.create(interface) sign_fn = signing.sign_unsigned key = None - options.edit = True + options.edit = not options.create else: sys.exit(1) diff --git a/edit.py b/edit.py index d28a1e9..eea5125 100644 --- a/edit.py +++ b/edit.py @@ -12,7 +12,7 @@ def available_in_path(command): return False def edit(data): - fd, tmp = tempfile.mkstemp(prefix = '0publish-') + fd, tmp = tempfile.mkstemp(prefix = '0publish-', suffix = '.xml') try: stream = os.fdopen(fd, 'w') stream.write(data) -- 2.11.4.GIT