vimrc cleanup, new versions
git-svn-id: http://photonzero.com/dotfiles/trunk@31 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
parent
143fd36427
commit
6becfb4ec2
7 changed files with 725 additions and 501 deletions
|
|
@ -1,17 +1,22 @@
|
||||||
"pythoncomplete.vim - Omni Completion for python
|
"pythoncomplete.vim - Omni Completion for python
|
||||||
" Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
|
" Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
|
||||||
" Version: 0.8
|
" Version: 0.9
|
||||||
" Last Updated: 8 Oct 2007
|
" Last Updated: 18 Jun 2009
|
||||||
"
|
"
|
||||||
" Changes
|
" Changes
|
||||||
" TODO:
|
" TODO:
|
||||||
" User defined docstrings aren't handled right...
|
|
||||||
" 'info' item output can use some formatting work
|
" 'info' item output can use some formatting work
|
||||||
" Add an "unsafe eval" mode, to allow for return type evaluation
|
" Add an "unsafe eval" mode, to allow for return type evaluation
|
||||||
" Complete basic syntax along with import statements
|
" Complete basic syntax along with import statements
|
||||||
" i.e. "import url<c-x,c-o>"
|
" i.e. "import url<c-x,c-o>"
|
||||||
" Continue parsing on invalid line??
|
" Continue parsing on invalid line??
|
||||||
"
|
"
|
||||||
|
" v 0.9
|
||||||
|
" * Fixed docstring parsing for classes and functions
|
||||||
|
" * Fixed parsing of *args and **kwargs type arguments
|
||||||
|
" * Better function param parsing to handle things like tuples and
|
||||||
|
" lambda defaults args
|
||||||
|
"
|
||||||
" v 0.8
|
" v 0.8
|
||||||
" * Fixed an issue where the FIRST assignment was always used instead of
|
" * Fixed an issue where the FIRST assignment was always used instead of
|
||||||
" using a subsequent assignment for a variable
|
" using a subsequent assignment for a variable
|
||||||
|
|
@ -69,7 +74,7 @@ function! pythoncomplete#Complete(findstart, base)
|
||||||
while idx > 0
|
while idx > 0
|
||||||
let idx -= 1
|
let idx -= 1
|
||||||
let c = line[idx]
|
let c = line[idx]
|
||||||
if c =~ '\w' || c =~ '\.' || c == '('
|
if c =~ '\w' || c =~ '\.'
|
||||||
let cword = c . cword
|
let cword = c . cword
|
||||||
continue
|
continue
|
||||||
elseif strlen(cword) > 0 || idx == 0
|
elseif strlen(cword) > 0 || idx == 0
|
||||||
|
|
@ -212,7 +217,7 @@ class Completer(object):
|
||||||
if len(stmt) > 0 and stmt[-1] == '(':
|
if len(stmt) > 0 and stmt[-1] == '(':
|
||||||
result = eval(_sanitize(stmt[:-1]), self.compldict)
|
result = eval(_sanitize(stmt[:-1]), self.compldict)
|
||||||
doc = result.__doc__
|
doc = result.__doc__
|
||||||
if doc == None: doc = ''
|
if doc is None: doc = ''
|
||||||
args = self.get_arguments(result)
|
args = self.get_arguments(result)
|
||||||
return [{'word':self._cleanstr(args),'info':self._cleanstr(doc)}]
|
return [{'word':self._cleanstr(args),'info':self._cleanstr(doc)}]
|
||||||
elif ridx == -1:
|
elif ridx == -1:
|
||||||
|
|
@ -229,18 +234,18 @@ class Completer(object):
|
||||||
|
|
||||||
try: maindoc = result.__doc__
|
try: maindoc = result.__doc__
|
||||||
except: maindoc = ' '
|
except: maindoc = ' '
|
||||||
if maindoc == None: maindoc = ' '
|
if maindoc is None: maindoc = ' '
|
||||||
for m in all:
|
for m in all:
|
||||||
if m == "_PyCmplNoType": continue #this is internal
|
if m == "_PyCmplNoType": continue #this is internal
|
||||||
try:
|
try:
|
||||||
dbg('possible completion: %s' % m)
|
dbg('possible completion: %s' % m)
|
||||||
if m.find(match) == 0:
|
if m.find(match) == 0:
|
||||||
if result == None: inst = all[m]
|
if result is None: inst = all[m]
|
||||||
else: inst = getattr(result,m)
|
else: inst = getattr(result,m)
|
||||||
try: doc = inst.__doc__
|
try: doc = inst.__doc__
|
||||||
except: doc = maindoc
|
except: doc = maindoc
|
||||||
typestr = str(inst)
|
typestr = str(inst)
|
||||||
if doc == None or doc == '': doc = maindoc
|
if doc is None or doc == '': doc = maindoc
|
||||||
|
|
||||||
wrd = m[len(match):]
|
wrd = m[len(match):]
|
||||||
c = {'word':wrd, 'abbr':m, 'info':self._cleanstr(doc)}
|
c = {'word':wrd, 'abbr':m, 'info':self._cleanstr(doc)}
|
||||||
|
|
@ -266,9 +271,9 @@ class Completer(object):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
class Scope(object):
|
class Scope(object):
|
||||||
def __init__(self,name,indent):
|
def __init__(self,name,indent,docstr=''):
|
||||||
self.subscopes = []
|
self.subscopes = []
|
||||||
self.docstr = ''
|
self.docstr = docstr
|
||||||
self.locals = []
|
self.locals = []
|
||||||
self.parent = None
|
self.parent = None
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
@ -287,6 +292,7 @@ class Scope(object):
|
||||||
while d.find(' ') > -1: d = d.replace(' ',' ')
|
while d.find(' ') > -1: d = d.replace(' ',' ')
|
||||||
while d[0] in '"\'\t ': d = d[1:]
|
while d[0] in '"\'\t ': d = d[1:]
|
||||||
while d[-1] in '"\'\t ': d = d[:-1]
|
while d[-1] in '"\'\t ': d = d[:-1]
|
||||||
|
dbg("Scope(%s)::docstr = %s" % (self,d))
|
||||||
self.docstr = d
|
self.docstr = d
|
||||||
|
|
||||||
def local(self,loc):
|
def local(self,loc):
|
||||||
|
|
@ -295,7 +301,7 @@ class Scope(object):
|
||||||
|
|
||||||
def copy_decl(self,indent=0):
|
def copy_decl(self,indent=0):
|
||||||
""" Copy a scope's declaration only, at the specified indent level - not local variables """
|
""" Copy a scope's declaration only, at the specified indent level - not local variables """
|
||||||
return Scope(self.name,indent)
|
return Scope(self.name,indent,self.docstr)
|
||||||
|
|
||||||
def _checkexisting(self,test):
|
def _checkexisting(self,test):
|
||||||
"Convienance function... keep out duplicates"
|
"Convienance function... keep out duplicates"
|
||||||
|
|
@ -306,9 +312,8 @@ class Scope(object):
|
||||||
self.locals.remove(l)
|
self.locals.remove(l)
|
||||||
|
|
||||||
def get_code(self):
|
def get_code(self):
|
||||||
# we need to start with this, to fix up broken completions
|
str = ""
|
||||||
# hopefully this name is unique enough...
|
if len(self.docstr) > 0: str += '"""'+self.docstr+'"""\n'
|
||||||
str = '"""'+self.docstr+'"""\n'
|
|
||||||
for l in self.locals:
|
for l in self.locals:
|
||||||
if l.startswith('import'): str += l+'\n'
|
if l.startswith('import'): str += l+'\n'
|
||||||
str += 'class _PyCmplNoType:\n def __getattr__(self,name):\n return None\n'
|
str += 'class _PyCmplNoType:\n def __getattr__(self,name):\n return None\n'
|
||||||
|
|
@ -335,11 +340,11 @@ class Scope(object):
|
||||||
return ' '*(self.indent+1)
|
return ' '*(self.indent+1)
|
||||||
|
|
||||||
class Class(Scope):
|
class Class(Scope):
|
||||||
def __init__(self, name, supers, indent):
|
def __init__(self, name, supers, indent, docstr=''):
|
||||||
Scope.__init__(self,name,indent)
|
Scope.__init__(self,name,indent, docstr)
|
||||||
self.supers = supers
|
self.supers = supers
|
||||||
def copy_decl(self,indent=0):
|
def copy_decl(self,indent=0):
|
||||||
c = Class(self.name,self.supers,indent)
|
c = Class(self.name,self.supers,indent, self.docstr)
|
||||||
for s in self.subscopes:
|
for s in self.subscopes:
|
||||||
c.add(s.copy_decl(indent+1))
|
c.add(s.copy_decl(indent+1))
|
||||||
return c
|
return c
|
||||||
|
|
@ -356,11 +361,11 @@ class Class(Scope):
|
||||||
|
|
||||||
|
|
||||||
class Function(Scope):
|
class Function(Scope):
|
||||||
def __init__(self, name, params, indent):
|
def __init__(self, name, params, indent, docstr=''):
|
||||||
Scope.__init__(self,name,indent)
|
Scope.__init__(self,name,indent, docstr)
|
||||||
self.params = params
|
self.params = params
|
||||||
def copy_decl(self,indent=0):
|
def copy_decl(self,indent=0):
|
||||||
return Function(self.name,self.params,indent)
|
return Function(self.name,self.params,indent, self.docstr)
|
||||||
def get_code(self):
|
def get_code(self):
|
||||||
str = "%sdef %s(%s):\n" % \
|
str = "%sdef %s(%s):\n" % \
|
||||||
(self.currentindent(),self.name,','.join(self.params))
|
(self.currentindent(),self.name,','.join(self.params))
|
||||||
|
|
@ -376,7 +381,7 @@ class PyParser:
|
||||||
def _parsedotname(self,pre=None):
|
def _parsedotname(self,pre=None):
|
||||||
#returns (dottedname, nexttoken)
|
#returns (dottedname, nexttoken)
|
||||||
name = []
|
name = []
|
||||||
if pre == None:
|
if pre is None:
|
||||||
tokentype, token, indent = self.next()
|
tokentype, token, indent = self.next()
|
||||||
if tokentype != NAME and token != '*':
|
if tokentype != NAME and token != '*':
|
||||||
return ('', token)
|
return ('', token)
|
||||||
|
|
@ -410,17 +415,20 @@ class PyParser:
|
||||||
while True:
|
while True:
|
||||||
tokentype, token, indent = self.next()
|
tokentype, token, indent = self.next()
|
||||||
if token in (')', ',') and level == 1:
|
if token in (')', ',') and level == 1:
|
||||||
names.append(name)
|
if '=' not in name: name = name.replace(' ', '')
|
||||||
|
names.append(name.strip())
|
||||||
name = ''
|
name = ''
|
||||||
if token == '(':
|
if token == '(':
|
||||||
level += 1
|
level += 1
|
||||||
|
name += "("
|
||||||
elif token == ')':
|
elif token == ')':
|
||||||
level -= 1
|
level -= 1
|
||||||
if level == 0: break
|
if level == 0: break
|
||||||
|
else: name += ")"
|
||||||
elif token == ',' and level == 1:
|
elif token == ',' and level == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
name += str(token)
|
name += "%s " % str(token)
|
||||||
return names
|
return names
|
||||||
|
|
||||||
def _parsefunction(self,indent):
|
def _parsefunction(self,indent):
|
||||||
|
|
@ -500,17 +508,26 @@ class PyParser:
|
||||||
#Handle 'self' params
|
#Handle 'self' params
|
||||||
if scp.parent != None and type(scp.parent) == Class:
|
if scp.parent != None and type(scp.parent) == Class:
|
||||||
slice = 1
|
slice = 1
|
||||||
p = scp.params[0]
|
|
||||||
i = p.find('=')
|
|
||||||
if i != -1: p = p[:i]
|
|
||||||
newscope.local('%s = %s' % (scp.params[0],scp.parent.name))
|
newscope.local('%s = %s' % (scp.params[0],scp.parent.name))
|
||||||
for p in scp.params[slice:]:
|
for p in scp.params[slice:]:
|
||||||
i = p.find('=')
|
i = p.find('=')
|
||||||
if len(p) == 0: continue
|
if len(p) == 0: continue
|
||||||
|
pvar = ''
|
||||||
|
ptype = ''
|
||||||
if i == -1:
|
if i == -1:
|
||||||
newscope.local('%s = _PyCmplNoType()' % p)
|
pvar = p
|
||||||
|
ptype = '_PyCmplNoType()'
|
||||||
else:
|
else:
|
||||||
newscope.local('%s = %s' % (p[:i],_sanitize(p[i+1])))
|
pvar = p[:i]
|
||||||
|
ptype = _sanitize(p[i+1:])
|
||||||
|
if pvar.startswith('**'):
|
||||||
|
pvar = pvar[2:]
|
||||||
|
ptype = '{}'
|
||||||
|
elif pvar.startswith('*'):
|
||||||
|
pvar = pvar[1:]
|
||||||
|
ptype = '[]'
|
||||||
|
|
||||||
|
newscope.local('%s = %s' % (pvar,ptype))
|
||||||
|
|
||||||
for s in scp.subscopes:
|
for s in scp.subscopes:
|
||||||
ns = s.copy_decl(0)
|
ns = s.copy_decl(0)
|
||||||
|
|
@ -538,17 +555,19 @@ class PyParser:
|
||||||
self.scope = self.scope.pop(indent)
|
self.scope = self.scope.pop(indent)
|
||||||
elif token == 'def':
|
elif token == 'def':
|
||||||
func = self._parsefunction(indent)
|
func = self._parsefunction(indent)
|
||||||
if func == None:
|
if func is None:
|
||||||
print "function: syntax error..."
|
print "function: syntax error..."
|
||||||
continue
|
continue
|
||||||
|
dbg("new scope: function")
|
||||||
freshscope = True
|
freshscope = True
|
||||||
self.scope = self.scope.add(func)
|
self.scope = self.scope.add(func)
|
||||||
elif token == 'class':
|
elif token == 'class':
|
||||||
cls = self._parseclass(indent)
|
cls = self._parseclass(indent)
|
||||||
if cls == None:
|
if cls is None:
|
||||||
print "class: syntax error..."
|
print "class: syntax error..."
|
||||||
continue
|
continue
|
||||||
freshscope = True
|
freshscope = True
|
||||||
|
dbg("new scope: class")
|
||||||
self.scope = self.scope.add(cls)
|
self.scope = self.scope.add(cls)
|
||||||
|
|
||||||
elif token == 'import':
|
elif token == 'import':
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,11 @@ augroup END
|
||||||
augroup mako
|
augroup mako
|
||||||
au! BufRead,BufNewFile *.mak setfiletype mako
|
au! BufRead,BufNewFile *.mak setfiletype mako
|
||||||
augroup END
|
augroup END
|
||||||
|
augroup python
|
||||||
|
autocmd FileType python set omnifunc=pythoncomplete#Complete
|
||||||
|
autocmd FileType python call SuperTabSetCompletionType("<C-X><C-O>")
|
||||||
|
autocmd FileType python set completeopt-=preview
|
||||||
|
autocmd FileType python set ts=4
|
||||||
|
autocmd FileType python set softtabstop=4
|
||||||
|
autocmd FileType python set shiftwidth=4
|
||||||
|
augroup END
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
18
.vimrc
18
.vimrc
|
|
@ -4,36 +4,38 @@ syntax on
|
||||||
"colorscheme dante
|
"colorscheme dante
|
||||||
colorscheme barak
|
colorscheme barak
|
||||||
"set gfn=Monaco:h12:a
|
"set gfn=Monaco:h12:a
|
||||||
set ts=4
|
set ts=8
|
||||||
set softtabstop=4
|
set softtabstop=8
|
||||||
set shiftwidth=4
|
set shiftwidth=8
|
||||||
"set expandtab
|
"set expandtab
|
||||||
set smartcase
|
set smartcase
|
||||||
set autoindent
|
set autoindent
|
||||||
set smartindent
|
set smartindent
|
||||||
set hidden
|
set hidden
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
|
||||||
set history=1000
|
set history=1000
|
||||||
set wildmenu
|
set wildmenu
|
||||||
set wildmode=list:longest
|
set wildmode=list:longest
|
||||||
set ruler
|
set ruler
|
||||||
|
|
||||||
|
|
||||||
"Sources
|
"Sources
|
||||||
source ~/.vim/supertab.vim
|
"source ~/.vim/supertab.vim
|
||||||
source ~/.vim/charm.vim
|
"source ~/.vim/charm.vim
|
||||||
source ~/.vim/plugin/AppleT.vim
|
"source ~/.vim/plugin/AppleT.vim
|
||||||
runtime macros/matchit.vim
|
runtime macros/matchit.vim
|
||||||
"source ~/.vim/syntax/motd.vim
|
|
||||||
|
|
||||||
|
|
||||||
au BufNewFile,BufRead motd.public,/tmp/motd.public.r.* setf motd
|
au BufNewFile,BufRead motd.public,/tmp/motd.public.r.* setf motd
|
||||||
"Highlighting features
|
"Highlighting features
|
||||||
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
|
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
|
||||||
autocmd FileType python set tags+=$HOME/.vim/tags/python.ctags
|
autocmd FileType python set tags+=$HOME/.vim/tags/python.ctags
|
||||||
autocmd FileType python set omnifunc=pythoncomplete#Complete
|
"autocmd FileType python set omnifunc=pythoncomplete#Complete
|
||||||
"autocmd FileType python call SuperTabSetCompletionType("<C-X><C-O>")
|
"autocmd FileType python call SuperTabSetCompletionType("<C-X><C-O>")
|
||||||
let python_highlight_all = 1
|
let python_highlight_all = 1
|
||||||
let g:Tb_MaxSize=0
|
let g:Tb_MaxSize=0
|
||||||
|
let g:Tb_MapCTabSwitchBufs = 1
|
||||||
au Filetype html,xml,xsl source ~/.vim/closetag.vim
|
au Filetype html,xml,xsl source ~/.vim/closetag.vim
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
3
bin/prowl
Executable file
3
bin/prowl
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
$HOME/bin/prowl.pl -apikeyfile=$HOME/.prowlapi -event="Notice" -notification="$1"
|
||||||
154
bin/prowl.pl
Executable file
154
bin/prowl.pl
Executable file
|
|
@ -0,0 +1,154 @@
|
||||||
|
#!/usr/bin/perl -w
|
||||||
|
# ProwlScript, to communicate with the Prowl server.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009, Zachary West
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of Zachary West nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY Zachary West ''AS IS'' AND ANY
|
||||||
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL Zachary West BE LIABLE FOR ANY
|
||||||
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# This requires running Prowl on your device.
|
||||||
|
# See the Prowl website <http://prowl.weks.net>
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use LWP::UserAgent;
|
||||||
|
use Getopt::Long;
|
||||||
|
use Pod::Usage;
|
||||||
|
|
||||||
|
# Grab our options.
|
||||||
|
my %options = ();
|
||||||
|
GetOptions(\%options, 'apikey=s', 'apikeyfile=s',
|
||||||
|
'application=s', 'event=s', 'notification=s',
|
||||||
|
'priority:i', 'help|?') or pod2usage(2);
|
||||||
|
|
||||||
|
$options{'application'} ||= "ProwlScript";
|
||||||
|
$options{'priority'} ||= 0;
|
||||||
|
|
||||||
|
pod2usage(-verbose => 2) if (exists($options{'help'}));
|
||||||
|
pod2usage(-message => "$0: Event name is required") if (!exists($options{'event'}));
|
||||||
|
pod2usage(-message => "$0: Notification text is required") if (!exists($options{'notification'}));
|
||||||
|
pod2usage(-priority => "$0: Priority must be in the range [-2, 2]") if ($options{'priority'} < -2 || $options{'priority'} > 2);
|
||||||
|
|
||||||
|
# Get the API key from STDIN if one isn't provided via a file or from the command line.
|
||||||
|
if (!exists($options{'apikey'}) && !exists($options{'apikeyfile'})) {
|
||||||
|
print "API key: ";
|
||||||
|
|
||||||
|
$options{'apikey'} = <STDIN>;
|
||||||
|
chomp $options{'apikey'};
|
||||||
|
} elsif (exists($options{'apikeyfile'})) {
|
||||||
|
open(APIKEYFILE, $options{'apikeyfile'}) or die($!);
|
||||||
|
$options{'apikey'} = <APIKEYFILE>;
|
||||||
|
close(APIKEYFILE);
|
||||||
|
|
||||||
|
chomp $options{'apikey'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# URL encode our arguments
|
||||||
|
$options{'application'} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
|
||||||
|
$options{'event'} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
|
||||||
|
$options{'notification'} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
|
||||||
|
|
||||||
|
# Generate our HTTP request.
|
||||||
|
my ($userAgent, $request, $response, $requestURL);
|
||||||
|
$userAgent = LWP::UserAgent->new;
|
||||||
|
$userAgent->agent("ProwlScript/1.0");
|
||||||
|
|
||||||
|
$requestURL = sprintf("https://prowl.weks.net/publicapi/add?apikey=%s&application=%s&event=%s&description=%s&priority=%d",
|
||||||
|
$options{'apikey'},
|
||||||
|
$options{'application'},
|
||||||
|
$options{'event'},
|
||||||
|
$options{'notification'},
|
||||||
|
$options{'priority'});
|
||||||
|
|
||||||
|
$request = HTTP::Request->new(GET => $requestURL);
|
||||||
|
|
||||||
|
$response = $userAgent->request($request);
|
||||||
|
|
||||||
|
if ($response->is_success) {
|
||||||
|
print "Notification successfully posted.\n";
|
||||||
|
} elsif ($response->code == 401) {
|
||||||
|
print STDERR "Notification not posted: incorrect API key.\n";
|
||||||
|
} else {
|
||||||
|
print STDERR "Notification not posted: " . $response->content . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
prowl - Send Prowl notifications
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
prowl.pl [options] event_information
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-help Display all help information.
|
||||||
|
-apikey=... Your Prowl API key.
|
||||||
|
-apikeyfile=... A file containing your Prowl API key.
|
||||||
|
|
||||||
|
Event information:
|
||||||
|
-application=... The name of the application.
|
||||||
|
-event=... The name of the event.
|
||||||
|
-notification=... The text of the notification.
|
||||||
|
-priority=... The priority of the notification.
|
||||||
|
An integer in the range [-2, 2].
|
||||||
|
|
||||||
|
=head1 OPTIONS
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<-apikey>
|
||||||
|
|
||||||
|
Your Prowl API key. It is not recommend you use this, use the apikeyfile option.
|
||||||
|
|
||||||
|
=item B<-apikeyfile>
|
||||||
|
|
||||||
|
A file containing one line, which has your Prowl API key on it.
|
||||||
|
|
||||||
|
=item B<-application>
|
||||||
|
|
||||||
|
The name of the Application part of the notification. If none is provided, ProwlScript is used.
|
||||||
|
|
||||||
|
=item B<-event>
|
||||||
|
|
||||||
|
The name of the Event part of the notification. This is generally the action which occurs, such as "disk partitioning completed."
|
||||||
|
|
||||||
|
=item B<-notification>
|
||||||
|
|
||||||
|
The text of the notification, which has more details for a particular event. This is generally the description of the action which occurs, such as "The disk /dev/abc was successfully partitioned."
|
||||||
|
|
||||||
|
=item B<-notification>
|
||||||
|
|
||||||
|
The priority level of the notification. An integer value ranging [-2, 2] with meanings Very Low, Moderate, Normal, High, Emergency.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
B<This program> sends a notification to the Prowl server, which is then forwarded to your device running the Prowl application.
|
||||||
|
|
||||||
|
=head1 HELP
|
||||||
|
|
||||||
|
For more assistance, visit the Prowl website at <http://prowl.weks.net>.
|
||||||
|
|
||||||
|
=cut
|
||||||
Loading…
Add table
Add a link
Reference in a new issue