/src/lib/cli/internal/clarg_not.e

http://github.com/tybor/Liberty · Specman e · 114 lines · 74 code · 17 blank · 23 comment · 2 complexity · c966316a713da8b3056c4ab29515b78f MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class CLARG_NOT
  5. inherit
  6. COMMAND_LINE_ARGUMENT
  7. redefine
  8. prefix "not"
  9. end
  10. create {COMMAND_LINE_ARGUMENT}
  11. make
  12. feature {ANY}
  13. is_repeatable: BOOLEAN False
  14. prefix "not": COMMAND_LINE_ARGUMENT
  15. do
  16. Result := arg
  17. end
  18. is_set: BOOLEAN
  19. do
  20. Result := not arg.is_set
  21. end
  22. is_mandatory: BOOLEAN
  23. do
  24. Result := arg.is_mandatory
  25. end
  26. is_set_at (context: COMMAND_LINE_CONTEXT): BOOLEAN
  27. do
  28. Result := not arg.is_set_at(context)
  29. end
  30. feature {COMMAND_LINE_ARGUMENTS, COMMAND_LINE_ARGUMENT}
  31. prepare_parse
  32. do
  33. arg.prepare_parse
  34. end
  35. parse_command_line (context: COMMAND_LINE_CONTEXT): COMMAND_LINE_CONTEXT
  36. do
  37. Result := arg.parse_command_line(context)
  38. if not Result.is_parsed then
  39. Result := Result.default
  40. elseif arg.is_set then
  41. arg.undo_parse(context)
  42. Result := context
  43. end
  44. end
  45. undo_parse (context: COMMAND_LINE_CONTEXT)
  46. do
  47. arg.undo_parse(context)
  48. end
  49. usage_summary (stream: OUTPUT_STREAM)
  50. local
  51. i: INTEGER
  52. do
  53. stream.put_character('~')
  54. stream.put_character('(')
  55. arg.usage_summary(stream)
  56. stream.put_character(')')
  57. detailed := False
  58. end
  59. usage_details (stream: OUTPUT_STREAM)
  60. do
  61. if not detailed then
  62. arg.usage_details(stream)
  63. detailed := True
  64. end
  65. end
  66. feature {}
  67. arg: COMMAND_LINE_ARGUMENT
  68. make (a_arg: COMMAND_LINE_ARGUMENT)
  69. require
  70. a_arg /= Void
  71. do
  72. arg := a_arg
  73. end
  74. detailed: BOOLEAN
  75. invariant
  76. arg /= Void
  77. end -- class CLARG_NOT
  78. --
  79. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  80. --
  81. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  82. -- of this software and associated documentation files (the "Software"), to deal
  83. -- in the Software without restriction, including without limitation the rights
  84. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  85. -- copies of the Software, and to permit persons to whom the Software is
  86. -- furnished to do so, subject to the following conditions:
  87. --
  88. -- The above copyright notice and this permission notice shall be included in
  89. -- all copies or substantial portions of the Software.
  90. --
  91. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  92. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  93. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  94. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  95. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  96. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  97. -- THE SOFTWARE.