/src/lib/cli/internal/clarg_directory.e
Specman e | 63 lines | 31 code | 9 blank | 23 comment | 1 complexity | 37521848850fdd4fd19313bcaecd379b MD5 | raw file
1-- This file is part of a Liberty Eiffel library. 2-- See the full copyright at the end. 3-- 4class CLARG_DIRECTORY 5 6inherit 7 CLARG_WITH_ARG[DIRECTORY] 8 9create {COMMAND_LINE_ARGUMENT_FACTORY} 10 optional, positional 11 12feature {ANY} 13 item: DIRECTORY 14 15 is_set: BOOLEAN 16 do 17 Result := item /= Void 18 end 19 20feature {CLARG_PARSER} 21 is_valid_data (arg: STRING): BOOLEAN 22 do 23 bd.ensure_system_notation 24 if bd.system_notation.is_valid_path(arg) then 25 Result := ft.file_exists(arg) and then ft.is_directory(arg) 26 end 27 end 28 29feature {} 30 set_data (context: COMMAND_LINE_CONTEXT; arg: STRING) 31 do 32 create item.scan(arg) 33 end 34 35 unset 36 do 37 item := Void 38 end 39 40 bd: BASIC_DIRECTORY 41 ft: FILE_TOOLS 42 43end -- CLARG_DIRECTORY 44-- 45-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file. 46-- 47-- Permission is hereby granted, free of charge, to any person obtaining a copy 48-- of this software and associated documentation files (the "Software"), to deal 49-- in the Software without restriction, including without limitation the rights 50-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 51-- copies of the Software, and to permit persons to whom the Software is 52-- furnished to do so, subject to the following conditions: 53-- 54-- The above copyright notice and this permission notice shall be included in 55-- all copies or substantial portions of the Software. 56-- 57-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 58-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 59-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 60-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 61-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 62-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 63-- THE SOFTWARE.