You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import sys
import sys.arg as cli
import tag
traitCliEventHandler:
fntoggle_hyphenate(inoutself) raises:
...@valuestructApp(CliEventHandler):
varhyphenate: Bool
fntoggle_hyphenate(inoutself) raises:
ifself.hyphenate:
raise Error("You passed `--hyphenate` twice.")
else:
self.hyphenate =Truefnbase_arg[T: CliEventHandler](
inoutapp: T,
borrowedarg: String,
) raises -> Int:
if arg =="--col-width":
return tag.parse_col_width
elif arg =="--hyphenate":
try:
app.toggle_hyphenate()
except e:
print(e, file=sys.stderr)
return tag.stop
else:
raise Error("The argument `"+ arg +"` is undefined.")
fnmain():
varapp= App(hyphenate=False)
varstate: Int = tag.skip
for arg in cli.argv():
if state == tag.do_base_arg:
try:
state = base_arg(app, arg)
except e:
print(e, file=sys.stderr)
returnelif state == tag.stop:
returnelif state == tag.skip:
state = tag.do_base_arg
continueelse:
print("OMG")
return
src/tag/__init.mojo
"""Implements the tag package.The tag package represents the app's events in its timeline as tags."""from .constants import do_base_arg, parse_col_width, print_help, stop, skip
Actually, because I assumed it so my bad. This is not the same bug. I thought in a fn declaration mojo var is required. So this isn't the same thing. What would be the same thing is this:
# bug.mojoimport tag
fnmain():
varstate= tag.A
state = tag.B
# tag.mojoaliasA=0aliasB=1
Don't you think? Also this way does indeed reproduce the correct error that I was seeing.
Bug description
All the code
src/colcat.mojo
src/tag/__init.mojo
src/tag/constants.mojo
Steps to reproduce
mojo init --format mojoproject
.System information
The text was updated successfully, but these errors were encountered: