parent
ada40b4224
commit
f8aa9c2cab
15
README
15
README
|
@ -18,15 +18,16 @@ commented, although currently there is only one author. Buyer beware!
|
|||
Requirements:
|
||||
1. python 2.3 or higher
|
||||
2. ncurses
|
||||
3. bash
|
||||
|
||||
Optional Dependencies:
|
||||
1. ispell
|
||||
2. aespipe
|
||||
3. perl
|
||||
4. ctags
|
||||
5. cvs
|
||||
6. svn
|
||||
7. grep
|
||||
* aespipe [for aes-encrypted buffers]
|
||||
* ctags [for ctags support]
|
||||
* cvs [for cvs-based commands]
|
||||
* grep [for grep-based commands]
|
||||
* ispell [for spell-as-you-type]
|
||||
* perl [for perl syntax-checking]
|
||||
* svn [for svn-based commands]
|
||||
|
||||
Quick Start Guide:
|
||||
1. Download and unpack the pmacs tarball file. After this, there should be
|
||||
|
|
19
mode/sh.py
19
mode/sh.py
|
@ -1,5 +1,7 @@
|
|||
import commands
|
||||
import color, mode2, tab2
|
||||
from lex3 import Grammar, PatternRule, RegionRule
|
||||
from method import Method
|
||||
|
||||
class StringGrammar(Grammar):
|
||||
rules = [
|
||||
|
@ -94,5 +96,18 @@ class Sh(mode2.Fundamental):
|
|||
'comment': ('red', 'default'),
|
||||
'continuation': ('red', 'default'),
|
||||
}
|
||||
def name(self):
|
||||
return "Sh"
|
||||
def __init__(self, w):
|
||||
mode2.Fundamental.__init__(self, w)
|
||||
self.add_action_and_bindings(ShCheckSyntax(), ('C-c s',))
|
||||
|
||||
class ShCheckSyntax(Method):
|
||||
'''Check the syntax of a shell script'''
|
||||
def _execute(self, w, **vargs):
|
||||
app = w.application
|
||||
cmd = "bash -n %r" % w.buffer.path
|
||||
(status, output) = commands.getstatusoutput(cmd)
|
||||
if status == 0:
|
||||
app.set_error("Syntax OK")
|
||||
app.data_buffer("*Sh-Check-Syntax*", output, switch_to=False)
|
||||
else:
|
||||
app.data_buffer("*Sh-Check-Syntax*", output)
|
||||
|
|
Loading…
Reference in New Issue