mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-03 08:32:42 +01:00
Remove need to pass nick as command-line parameter to expand/paren modules (use add_nick factoid metadata)
This commit is contained in:
parent
9b2c374bbb
commit
818ad29914
@ -13,8 +13,8 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 496,
|
||||
BUILD_DATE => "2014-03-03",
|
||||
BUILD_REVISION => 497,
|
||||
BUILD_DATE => "2014-03-04",
|
||||
};
|
||||
|
||||
1;
|
||||
|
@ -21,7 +21,6 @@ if($#ARGV < 1) {
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $nick = shift @ARGV;
|
||||
my $code = join ' ', @ARGV;
|
||||
my $lang = 'C89';
|
||||
my $args = "";
|
||||
@ -301,9 +300,9 @@ if(not $has_main) {
|
||||
$result =~ s/\s*}\s*$//;
|
||||
}
|
||||
|
||||
$output = $result;
|
||||
$output = length $result ? $result : $nooutput;
|
||||
|
||||
print "$nick: $output\n";
|
||||
print "$output\n";
|
||||
|
||||
sub execute {
|
||||
my $timeout = shift @_;
|
||||
|
@ -66,17 +66,17 @@ def parenthesize(source):
|
||||
try:
|
||||
ast = parser.parse(source, '<input>')
|
||||
except plyparser.ParseError as e:
|
||||
print("{0}: Error: {1}".format(sys.argv[1], e.args[0]))
|
||||
print("Error: " + e.args[0])
|
||||
return
|
||||
generator = CGenerator()
|
||||
print("{0}: {1}".format(sys.argv[1], generator.visit(ast)))
|
||||
print(generator.visit(ast))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 2:
|
||||
parenthesize(' '.join(sys.argv[2:]).rstrip(';'))
|
||||
elif len(sys.argv) == 2:
|
||||
print(sys.argv[1] + ': ' + "Usage: paren <expression>")
|
||||
if len(sys.argv) > 1:
|
||||
parenthesize(' '.join(sys.argv[1:]).rstrip(';'))
|
||||
elif len(sys.argv) == 1:
|
||||
print("Usage: paren <expression>")
|
||||
else:
|
||||
print('error')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user