Skip to content

Commit

Permalink
Console example fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed May 21, 2022
1 parent 9706ead commit 8b89ff5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions console/src/test/java/org/jline/example/Console.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2021, the original author or authors.
* Copyright (c) 2002-2022, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -371,14 +371,15 @@ public void complete(LineReader reader, ParsedLine line, List<Candidate> candida
// Command registers
//
Supplier<Path> workDir = () -> Paths.get(System.getProperty("user.dir"));
Builtins builtins = new Builtins(workDir, null, null);
ConfigurationPath configPath = new ConfigurationPath(Paths.get("."), Paths.get("."));
Builtins builtins = new Builtins(workDir, configPath, null);
builtins.rename(Builtins.Command.TTOP, "top");
builtins.alias("zle", "widget");
builtins.alias("bindkey", "keymap");
Printer printer = new DefaultPrinter(null);
Printer myPrinter = new MyPrinter(null, terminal);
ExampleCommands exampleCommands = new ExampleCommands(printer, myPrinter);
SystemRegistryImpl masterRegistry = new SystemRegistryImpl(parser, terminal, workDir, null);
SystemRegistryImpl masterRegistry = new SystemRegistryImpl(parser, terminal, workDir, configPath);
masterRegistry.setCommandRegistries(exampleCommands, builtins);
masterRegistry.addCompleter(completer);
//
Expand Down

0 comments on commit 8b89ff5

Please sign in to comment.