Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simuDAtor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
simuDAtor
Commits
aca90974
Commit
aca90974
authored
10 months ago
by
Johannes Kung
Browse files
Options
Downloads
Patches
Plain Diff
Fixed CLI print bug and removed unnecessary command
parent
43cef2ba
No related branches found
No related tags found
1 merge request
!14
Updated CLI help text + refactoring
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/simudator/cli/cli.py
+19
-30
19 additions, 30 deletions
src/simudator/cli/cli.py
with
19 additions
and
30 deletions
src/simudator/cli/cli.py
+
19
−
30
View file @
aca90974
...
...
@@ -13,7 +13,7 @@ CLI control:
Simulation control:
- n [x], next [x]: Simulates x ticks.
If no x is given simulates one tick.
If no x is given
,
simulates one tick.
- rc, run_continuously:
Continuously simulate ticks until a HALT is signalled
...
...
@@ -29,12 +29,10 @@ State information:
- p, print: Prints all states of all modules.
- p [name*], print [name*]:
Prints the states with given name. Prints all modules if no names are given.
- 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.
- pl, printlist [add/remove] [module name] ...:
Add or remove the given modules to a list of modules to print. If no
arguments are given, i.e.
"
pl
"
or
"
printlist
"
on their own, all the modules
in the list will be printed.
- pp, pretty print: Prints relevant processor state information in a
readable and compact format.
...
...
@@ -186,16 +184,6 @@ class CLI:
module
.
print_module
()
print
(
"
\n
"
)
case
[
"
p
"
,
*
_
]
|
[
"
print
"
,
*
_
]:
print
(
"
\n
"
)
# print modules with given names
for
name
in
user_input
.
split
()[
1
:]:
try
:
self
.
processor
.
get_module
(
name
).
print_module
()
print
(
"
\n
"
)
except
KeyError
:
print
(
"
\n
No module named
"
,
name
,
"
\n
"
)
case
[
"
pl
"
,
*
_
]
|
[
"
printlist
"
,
*
_
]:
self
.
print_list_command
(
user_input
.
split
())
...
...
@@ -325,24 +313,25 @@ class CLI:
print
(
"
\n
"
)
return
names
=
user_input
[
2
:]
# add name to print list
if
user_input
[
1
]
==
"
add
"
:
name
=
user_input
[
2
]
# check if name exists
try
:
self
.
processor
.
get_module
(
name
)
except
KeyError
:
print
(
"
\n
No module named
"
,
name
,
"
\n
"
)
return
for
name
in
names
:
# check if name exists
try
:
self
.
processor
.
get_module
(
name
)
if
name
not
in
self
.
print_list
:
self
.
print_list
.
append
(
name
)
except
KeyError
:
print
(
"
No module named
"
,
name
,)
self
.
print_list
.
append
(
name
)
elif
user_input
[
1
]
==
"
remove
"
:
name
=
user_input
[
2
]
if
name
in
self
.
print_list
:
self
.
print_list
.
remove
(
name
)
else
:
print
(
name
,
"
not in print list
"
)
for
name
in
names
:
if
name
in
self
.
print_list
:
self
.
print_list
.
remove
(
name
)
else
:
print
(
name
,
"
not in print list
"
)
else
:
print
(
"
Unknown command
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment