Remove need to pass nick as command-line parameter to expand/paren modules (use add_nick factoid metadata)

This commit is contained in:
Pragmatic Software 2014-03-04 10:43:28 +00:00
parent 9b2c374bbb
commit 818ad29914
3 changed files with 10 additions and 11 deletions

View File

@ -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;

View File

@ -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 @_;

View File

@ -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')