Home / Function/ printUsage() — spring-boot Function Reference

printUsage() — spring-boot Function Reference

Architecture documentation for the printUsage() function in CommandCompleter.java from the spring-boot codebase.

Function java GradlePlugin AotProcessing calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  4668403a_7669_2c41_b083_59890a9e7292["printUsage()"]
  805c6bc4_33f9_84a8_6478_8dfd3c78589f["complete()"]
  805c6bc4_33f9_84a8_6478_8dfd3c78589f -->|calls| 4668403a_7669_2c41_b083_59890a9e7292
  ec2b6e29_9120_be33_8c7e_b470c569b97a["OptionHelpLine()"]
  4668403a_7669_2c41_b083_59890a9e7292 -->|calls| ec2b6e29_9120_be33_8c7e_b470c569b97a
  dd76dc71_5e18_672a_30a6_4ccda5685cbb["getOptions()"]
  4668403a_7669_2c41_b083_59890a9e7292 -->|calls| dd76dc71_5e18_672a_30a6_4ccda5685cbb
  30c180a5_88d2_4837_c424_e48590ed9959["getUsage()"]
  4668403a_7669_2c41_b083_59890a9e7292 -->|calls| 30c180a5_88d2_4837_c424_e48590ed9959
  8f3704bf_0516_ae8f_5ba1_34c8d06115d2["error()"]
  4668403a_7669_2c41_b083_59890a9e7292 -->|calls| 8f3704bf_0516_ae8f_5ba1_34c8d06115d2
  style 4668403a_7669_2c41_b083_59890a9e7292 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java lines 96–118

	private void printUsage(Command command) {
		try {
			int maxOptionsLength = 0;
			List<OptionHelpLine> optionHelpLines = new ArrayList<>();
			for (OptionHelp optionHelp : command.getOptionsHelp()) {
				OptionHelpLine optionHelpLine = new OptionHelpLine(optionHelp);
				optionHelpLines.add(optionHelpLine);
				maxOptionsLength = Math.max(maxOptionsLength, optionHelpLine.getOptions().length());
			}

			this.console.println();
			this.console.println("Usage:");
			this.console.println(command.getName() + " " + command.getUsageHelp());
			for (OptionHelpLine optionHelpLine : optionHelpLines) {
				this.console.println(String.format("\t%" + maxOptionsLength + "s: %s", optionHelpLine.getOptions(),
						optionHelpLine.getUsage()));
			}
			this.console.drawLine();
		}
		catch (IOException ex) {
			Log.error(ex.getMessage() + " (" + ex.getClass().getName() + ")");
		}
	}

Domain

Subdomains

Called By

  • complete()

Frequently Asked Questions

What does printUsage() do?
printUsage() is a function in the spring-boot codebase.
What does printUsage() call?
printUsage() calls 4 function(s): OptionHelpLine, error, getOptions, getUsage.
What calls printUsage()?
printUsage() is called by 1 function(s): complete.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free