Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target中的逻辑错误 #6

Closed
meinming opened this issue Sep 3, 2022 · 3 comments · Fixed by #7
Closed

Target中的逻辑错误 #6

meinming opened this issue Sep 3, 2022 · 3 comments · Fixed by #7
Assignees
Labels
bug Something isn't working

Comments

@meinming
Copy link
Collaborator

meinming commented Sep 3, 2022

@dev
Target中,-t-f的判断如下:

        if '-h' in text:
            P_text(PRINT_HELP)

        elif '-t' in text:
            i = text.index('-t')
            res = func(text[i+1])
            P_text()
            print(f"return:{res}")
            return res

        elif '-f' in text:
            i = text.index('-f')
            files = OpenFiles(text[i+1])
            res = func(files)
            P_text()
            print(f"return: {res}")
            return res

        else:
            print(f'Invalid keyword: {text}, Maybe you can try "-h" to get help.')

那将会出现问题:

  1. 在同时使用-t-f时,她将只会使用-t去完成,如:
python .\114514.py -f a.txt -t 'So just yolo.'

结果为:

return:sO jUst YOLo.
  1. 当另一个参数不正确时,她并不会报告出来,如:
python .\114514.py -t 'So just yolo.' --out-put a.txt

命令本意是要把结果输出到a.txt,但不幸的是他写错了(一共才几个参数都能写错,你要知耻啊

结果为:

return:SO JuSt yOlo.

并没有报错来提示这个可怜的人,结果也没有输出到a.txt

@meinming meinming added the bug Something isn't working label Sep 3, 2022
@meinming meinming self-assigned this Sep 3, 2022
@meinming
Copy link
Collaborator Author

meinming commented Sep 4, 2022

尝试使用argparse模块或者optparse来解决相应问题

@meinming
Copy link
Collaborator Author

meinming commented Sep 5, 2022

尝试使用argparse模块或者optparse来解决相应问题

推翻上述决定,重构文件

@meinming
Copy link
Collaborator Author

meinming commented Sep 5, 2022

所述dev分支以改为1.0.2(版本号)

@meinming meinming linked a pull request Sep 5, 2022 that will close this issue
@surrtr surrtr closed this as completed in #7 Sep 5, 2022
@meinming meinming pinned this issue Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant