public RenderPrintWriter getWriter() { if (writer == null) { writer = new RenderPrintWriter(new ScreenContext() { public int getWidth() { return InvocationContextImpl.this.getWidth();
public final void print(Object obj, Style style) { try { out.append(style); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } print(obj); try { out.append(Style.reset); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } }
static void startFlow(@Usage("The class name of the flow to run, or an unambiguous substring") @Argument String name, @Usage("The data to pass as input") @Argument(unquote = false) List<String> input, RenderPrintWriter out, CordaRPCOps rpcOps, ANSIProgressRenderer ansiProgressRenderer) { if (name == null) { out.println("You must pass a name for the flow, see 'man flow'", Color.red); return; } String inp = input == null ? "" : String.join(" ", input).trim(); runFlowByNameFragment(name, inp, out, rpcOps, ansiProgressRenderer != null ? ansiProgressRenderer : new CRaSHANSIProgressRenderer(out) ); }
public final RenderPrintWriter cls() { try { out.cls(); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } return this; }
public final void open(CommandContext<Object> consumer) { // Set up current binding Binding binding = new Binding(consumer.getSession()); // Set the args on the script binding.setProperty("args", args); // setBinding(binding); // pushContext(new InvocationContextImpl<Object>(consumer)); // try { // Object res = run(); // Evaluate the closure if (res instanceof Closure) { Closure closure = (Closure)res; res = closure.call(args); } // if (res != null) { RenderPrintWriter writer = peekContext().getWriter(); if (writer.isEmpty()) { writer.print(res); } } } catch (Exception t) { throw CRaSHCommand.toScript(t); } }
} else { if (ret != null) { peekContext().getWriter().print(ret);
out.println("Please provide a hexadecimal transaction Id hash value, see 'man hash-lookup'", Color.red); return; txIdHashParsed = SecureHash.parse(txIdHash); } catch (IllegalArgumentException e) { out.println("The provided string is not a valid hexadecimal SHA-256 hash value", Color.red); return; out.println("Found a matching transaction with Id: " + found.toString()); } else { out.println("No matching transaction found", Color.red);
public final RenderPrintWriter cls() { try { out.cls(); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } return this; }
public final void print(Object obj, Color foreground, Color background) { try { out.append(Style.style(foreground, background)); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } print(obj); try { out.append(Style.reset); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } }
static void startFlow(@Usage("The class name of the flow to run, or an unambiguous substring") @Argument String name, @Usage("The data to pass as input") @Argument(unquote = false) List<String> input, RenderPrintWriter out, CordaRPCOps rpcOps, ANSIProgressRenderer ansiProgressRenderer, ObjectMapper om) { if (name == null) { out.println("You must pass a name for the flow, see 'man flow'", Color.red); return; } String inp = input == null ? "" : String.join(" ", input).trim(); runFlowByNameFragment(name, inp, out, rpcOps, ansiProgressRenderer != null ? ansiProgressRenderer : new CRaSHANSIProgressRenderer(out), om); }
public RenderPrintWriter getWriter() { if (writer == null) { writer = new RenderPrintWriter(new ScreenContext<Chunk>() { public Class<Chunk> getConsumedType() { return Chunk.class; } public int getWidth() { return outter.getWidth(); } public int getHeight() { return outter.getHeight(); } public void provide(Chunk element) throws IOException { Class<P> consumedType = consumer.getConsumedType(); if (consumedType.isInstance(element)) { P p = consumedType.cast(element); consumer.provide(p); } } public void flush() throws IOException { consumer.flush(); } }); } return writer; }
public final RenderPrintWriter cls() { try { out.cls(); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } return this; }
public final void print(Object obj, Color foreground) { try { out.append(Style.style(foreground)); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } print(obj); try { out.append(Style.reset); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } }
public RenderPrintWriter getWriter() { if (writer == null) { writer = new RenderPrintWriter(new ScreenContext<Chunk>() { public int getWidth() { return commandContext.getWidth(); } public int getHeight() { return commandContext.getHeight(); } public Class<Chunk> getConsumedType() { return Chunk.class; } public void provide(Chunk element) throws IOException { Class<P> consumedType = commandContext.getConsumedType(); if (consumedType.isInstance(element)) { P p = consumedType.cast(element); commandContext.provide(p); } } public void flush() throws IOException { commandContext.flush(); } }); } return writer; }
public final RenderPrintWriter cls() { try { out.provide(CLS.INSTANCE); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } return this; }
public final void print(Object obj, Decoration decoration) { try { out.append(Style.style(decoration)); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } print(obj); try { out.append(Style.reset); } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { setError(); } }