Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added option to set default description

  • Loading branch information...
commit a0814b3fb0cecc37147db0e8f9f1b161023fdda6 1 parent 60a9702
kiwi authored
Showing with 13 additions and 7 deletions.
  1. +12 −7 curlpaste
  2. +1 −0  curlpaste.conf
View
19 curlpaste
@@ -27,7 +27,7 @@ local LP = {
services = {}, --available services (addService)
options = {}, --available options (addOption)
files = {}, --files to create textdata (fileList)
- description = "", --description of paste, filename or -d <param> or stdin
+ description = DEFAULT_DESCRIPTION or "", --description of paste, filename or -d <param> or stdin
run = false,
private = false,
nick = DEFAULT_NICK or os.getenv("USER"),
@@ -71,7 +71,7 @@ local function addService(tbl, service_name, service_url, languages_tbl, body_fu
languages = languages_tbl,
matcher = url_match or nil,
curl_args = body_func, --function to create curl args
- file = ""
+-- file = ""
}
end
@@ -439,16 +439,18 @@ setOptions(LP)
local function checkService(tbl)
- if not LP.services[LP.service] then
+ if not tbl.services[tbl.service] then
print("Invalid service.")
- LP.cont = false
- return
+ tbl.cont = false
end
end
checkService(LP)
-if not LP.cont then return end
+if not LP.cont then
+ cleanup(LP)
+ return
+end
local function checkLanguage(tbl)
if not (function()
@@ -472,7 +474,10 @@ end
checkLanguage(LP)
--non-post option specified
-if not LP.cont then return end
+if not LP.cont then
+ cleanup(LP)
+ return
+end
--service
--[[
View
1  curlpaste.conf
@@ -1,3 +1,4 @@
+DEFAULT_DESCRIPTION = ""
DEFAULT_NICK = os.getenv("USER")
DEFAULT_LANGUAGE = "Plain Text"
DEFAULT_SERVICE = "codepad"
Please sign in to comment.
Something went wrong with that request. Please try again.