parent
ada40b4224
commit
f8aa9c2cab
15
README
15
README
|
@ -18,15 +18,16 @@ commented, although currently there is only one author. Buyer beware!
|
||||||
Requirements:
|
Requirements:
|
||||||
1. python 2.3 or higher
|
1. python 2.3 or higher
|
||||||
2. ncurses
|
2. ncurses
|
||||||
|
3. bash
|
||||||
|
|
||||||
Optional Dependencies:
|
Optional Dependencies:
|
||||||
1. ispell
|
* aespipe [for aes-encrypted buffers]
|
||||||
2. aespipe
|
* ctags [for ctags support]
|
||||||
3. perl
|
* cvs [for cvs-based commands]
|
||||||
4. ctags
|
* grep [for grep-based commands]
|
||||||
5. cvs
|
* ispell [for spell-as-you-type]
|
||||||
6. svn
|
* perl [for perl syntax-checking]
|
||||||
7. grep
|
* svn [for svn-based commands]
|
||||||
|
|
||||||
Quick Start Guide:
|
Quick Start Guide:
|
||||||
1. Download and unpack the pmacs tarball file. After this, there should be
|
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
|
import color, mode2, tab2
|
||||||
from lex3 import Grammar, PatternRule, RegionRule
|
from lex3 import Grammar, PatternRule, RegionRule
|
||||||
|
from method import Method
|
||||||
|
|
||||||
class StringGrammar(Grammar):
|
class StringGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
|
@ -94,5 +96,18 @@ class Sh(mode2.Fundamental):
|
||||||
'comment': ('red', 'default'),
|
'comment': ('red', 'default'),
|
||||||
'continuation': ('red', 'default'),
|
'continuation': ('red', 'default'),
|
||||||
}
|
}
|
||||||
def name(self):
|
def __init__(self, w):
|
||||||
return "Sh"
|
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