git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 1/4] git-p4: yes/no prompts should sanitize user text

From
Denton Liu <liu.denton@gmail.com>
Date
Dec 13, 2019, 22:54 UTC
Message-ID
<20191213225444.GA31452@generichostname>
In-Reply-To
<6c23cd56842e76e5c11f32ba59fd7729769ab4b7.1576245481.git.gitgitgadget@gmail.com>
Hi Ben,
On Fri, Dec 13, 2019 at 01:57:58PM +0000, Ben Keene via GitGitGadget wrote:
Show 27 quoted lines
> From: Ben Keene <seraphire@gmail.com>
> 
> When prompting the user interactively for direction, the tests are
> not forgiving of user input format.
> 
> For example, the first query asks for a yes/no response. If the user
> enters the full word "yes" or "no" or enters a capital "Y" the test
> will fail.
> 
> Create a new function, prompt(prompt_text) where
>   * prompt_text is the text prompt for the user
>   * returns a single character where valid return values are
>       found by inspecting prompt_text for single characters
>       surrounded by square brackets
> 
> This new function must  prompt the user for input and sanitize it by
> converting the response to a lower case string, trimming leading and
> trailing spaces, and checking if the first character is in the list
> of choices. If it is, return the first letter.
> 
> Change the current references to raw_input() to use this new function.
> 
> Since the method requires the returned text to be one of the available
> choices, remove the loop from the calling code that handles response
> verification.
> 
> Thanks-to: Denton Liu <Denton Liu>
Thanks-to: Denton Liu <liu.denton@gmail.com>?

Anyway, it's probably not worth a reroll. Aside from that, all the patches look good to me from a Python perspective.

> Signed-off-by: Ben Keene <seraphire@gmail.com>
Previous: Ben Keene via GitGitGadgetNext: Ben Keene
Message 34 of 46 in “git-p4: Usability enhancements”
  1. 0/3 git-p4: Usability enhancementsBen Keene via GitGitGadget, Dec 9, 2019
  2. 1/3 git-p4: [usability] yes/no prompts should sanitize user textBen Keene via GitGitGadget, Dec 9, 2019
  3. Junio C HamanoDec 9, 2019
  4. Ben KeeneDec 10, 2019
  5. 2/3 git-p4: [usability] RCS Keyword failure should suggest helpBen Keene via GitGitGadget, Dec 9, 2019
  6. Junio C HamanoDec 9, 2019
  7. 3/3 git-p4: [usability] Show detailed help when parsing options failBen Keene via GitGitGadget, Dec 9, 2019
  8. Junio C HamanoDec 9, 2019
  9. Junio C HamanoDec 9, 2019
  10. 0/4 git-p4: Usability enhancementsBen Keene via GitGitGadget, Dec 10, 2019
  11. 2/4 git-p4: show detailed help when parsing options failBen Keene via GitGitGadget, Dec 10, 2019
  12. 4/4 git-p4: failure because of RCS keywords should show helpBen Keene via GitGitGadget, Dec 10, 2019
  13. Denton LiuDec 11, 2019
  14. 3/4 git-p4: wrap patchRCSKeywords test to revert changes on failureBen Keene via GitGitGadget, Dec 10, 2019
  15. 1/4 git-p4: yes/no prompts should sanitize user textBen Keene via GitGitGadget, Dec 10, 2019
  16. Denton LiuDec 11, 2019
  17. Denton LiuDec 11, 2019
  18. Luke DiamandDec 11, 2019
  19. 0/4 git-p4: Usability enhancementsBen Keene via GitGitGadget, Dec 12, 2019
  20. 2/4 git-p4: show detailed help when parsing options failBen Keene via GitGitGadget, Dec 12, 2019
  21. 3/4 git-p4: wrap patchRCSKeywords test to revert changes on failureBen Keene via GitGitGadget, Dec 12, 2019
  22. 4/4 git-p4: failure because of RCS keywords should show helpBen Keene via GitGitGadget, Dec 12, 2019
  23. 1/4 git-p4: yes/no prompts should sanitize user textBen Keene via GitGitGadget, Dec 12, 2019
  24. Denton LiuDec 13, 2019
  25. Ben KeeneDec 13, 2019
  26. Junio C HamanoDec 13, 2019
  27. Johannes SchindelinDec 15, 2019
  28. Junio C HamanoDec 16, 2019
  29. Ben KeeneDec 16, 2019
  30. 0/4 git-p4: Usability enhancementsBen Keene via GitGitGadget, Dec 13, 2019
  31. 2/4 git-p4: show detailed help when parsing options failBen Keene via GitGitGadget, Dec 13, 2019
  32. 3/4 git-p4: wrap patchRCSKeywords test to revert changes on failureBen Keene via GitGitGadget, Dec 13, 2019
  33. 1/4 git-p4: yes/no prompts should sanitize user textBen Keene via GitGitGadget, Dec 13, 2019
  34. Denton LiuDec 13, 2019
  35. Ben KeeneDec 16, 2019
  36. 4/4 git-p4: failure because of RCS keywords should show helpBen Keene via GitGitGadget, Dec 13, 2019
  37. 0/4 git-p4: Usability enhancementsBen Keene via GitGitGadget, Dec 16, 2019
  38. 1/4 git-p4: yes/no prompts should sanitize user textBen Keene via GitGitGadget, Dec 16, 2019
  39. 4/4 git-p4: failure because of RCS keywords should show helpBen Keene via GitGitGadget, Dec 16, 2019
  40. 3/4 git-p4: wrap patchRCSKeywords test to revert changes on failureBen Keene via GitGitGadget, Dec 16, 2019
  41. 2/4 git-p4: show detailed help when parsing options failBen Keene via GitGitGadget, Dec 16, 2019
  42. Junio C HamanoDec 16, 2019
  43. Luke DiamandDec 21, 2019
  44. Junio C HamanoDec 25, 2019
  45. Ben KeeneJan 2, 2020
  46. Junio C HamanoJan 2, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.