From 019d137ef371671cb7ba01c7da5a22bb40f18a1b Mon Sep 17 00:00:00 2001 From: Johannes Kung <johku144@student.liu.se> Date: Tue, 11 Jun 2024 13:10:41 +0200 Subject: [PATCH] Updated CLI help command --- src/simudator/cli/cli.py | 92 ++++++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 28 deletions(-) diff --git a/src/simudator/cli/cli.py b/src/simudator/cli/cli.py index 7eb5e46..c92a65d 100644 --- a/src/simudator/cli/cli.py +++ b/src/simudator/cli/cli.py @@ -30,9 +30,6 @@ class CLI: user_input = input("> ") match user_input.split(): - case ["hi"] | ["hello"]: - print("Greeting!") - case ["c"] | ["clock"]: # shows current clockcycle print("Clock is at: ", str(self.processor.get_clock())) @@ -183,46 +180,85 @@ class CLI: # prints help message print( "Here is a list of possible commands:\n" - "- c, clock : Prints the processors current clock cycle.\n" - "- p [name*], print [name*]: Prints the states with " + "CLI control: \n" + " - h, help : Shows this message.\n" + + " - q, quit : Closes the program. Nothing will be saved.\n" + + "\n" + # --------------------------------------------------- + "Simulation control: \n" + " - n [x], next [x]: Simulates x ticks. " + "If no x is given simulates one tick.\n" + + " - rc, run_continuously: " + "Continuously simulate ticks until a HALT is signalled " + "or a breakpoint is reached.\n" + + " - r, reset : Resets processor to initial state.\n" + + " - u [x], undo [x]: Undos the last x clock cycle. " + "If no x is given one cycle is undone.\n" + + + "\n" + # --------------------------------------------------- + "State information: \n" + " - c, clock: Prints the processors current clock cycle.\n" + + " - p, print: Prints all states of all modules.\n" + + " - p [name*], print [name*]: Prints the states with " "given name. " "Will print all modules if no names are given.\n" - "- p br, print breaks: Prints all breakpoints.\n" - "- p br lam, print break lambdas: Prints all available " - "lambdas of this processor to use for lambda " - "breakpoints. \n" - "- pl, printlist [add] [remove]: " + + " - pl, printlist [add] [remove]: " "Prints all modules in the print list. " "Add or remove followed by a modules name " "will add or remove them from the print list.\n" - "- l, load [path]: " - "Loads a processors state from a given file path.\n" - "- r, reset : Resets processor to initial state.\n" - "- n [x], next [x]: Simulates x ticks. " - "If no x is given simulates one tick.\n" - "- rc, run_continuously: " - "Continuously simulate ticks until a HALT is signalled " - "or a breakpoint is reached.\n" - "- u [x], undo [x]: Undos the last x clock cycle. " - "If no x is given one cycle is undone.\n" - "- br, break [module name] [state name] [value]: " + + " - pp, pretty print: Prints relevant processor state information in a readable and compact format.\n" + + " - ppv, pretty print verbose: Prints all processor state information in a readable and compact format.\n" + + + "\n" + # --------------------------------------------------- + "Breakpoints: \n" + " - p br, print breaks: Prints all breakpoints.\n" + + " - p br lam, print break lambdas: Prints all available " + "lambdas of this processor to use for lambda " + "breakpoints. \n" + + " - br state, break state [module name] [state name] [value]: " "Add a breakpoint for the module with the given name. " "The breakpoint brakes when the specified state of the " "module has the specified value.\n" - "- br mem, break memory [module name] [adress] [value]: " + + " - br mem, break memory [module name] [adress] [value]: " "Add a breakpoint for a memory module with the given " "name. The breakpoint breaks when the specified adress " "of the memory has the specified value.\n" - "- br lam, break lambda [lambda_name] " - "[keyword argument] ...: Add a breakpoint that uses " + + " - br lam, break lambda [lambda_name] [keyword argument] ...: " + "Add a breakpoint that uses " "the referenced lambda to evaluate when to break. Any " "module names in the keyword arguments will be " "substituted with the actual module. Strings must be " "enclosed with quotation marks. \n" - "- rm br [id], remove break [id]: Remove the " - "breakpoint with the given ID.\n" - "- h, help : Shows this message.\n" - "- q, quit : Closes the program. Nothing will be saved." + + " - rm br [id], remove break [id]: " + "Remove the breakpoint with the given ID.\n" + + "\n" + # --------------------------------------------------- + "File I/O: \n" + " - l, load [path]: " + "Loads a processors state from a given file path.\n" + + " - sf, save to file [path]: " + "Saves the processor state to the specified file. \n" ) case ["q"] | ["quit"]: -- GitLab