diff --git a/docs/config.rst b/docs/config.rst index 75234f5..ff4bbdf 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -83,20 +83,20 @@ Here is how to print our :class:`Config` details: Root config object that enables us to handle the configuration options - Settings: - forcepermissive Access to option without verifying permissive properties - unrestraint Access to option without property restriction - nowarnings Do not warnings during validation - Commands: - cache Manage config cache - config Actions to Config - information Manage config informations - option Select an option - owner Global owner - permissive Manage config permissives - property Manage config properties - value Manage config value + description Get option description + dict Convert config and option to tiramisu format + get Get Tiramisu option + has_dependency Test if option has dependency + isdynamic Test if option is a dynamic optiondescription + isleadership Test if option is a leader or a follower + isoptiondescription Test if option is an optiondescription + list List options (by default list only option) + name Get option name + option Select an option by path + path Get option path + type Get de option type + updates Updates value with tiramisu format Then let's print our :class:`Option` details. @@ -105,16 +105,35 @@ Then let's print our :class:`Option` details. .. code-block:: bash - Select an option - - Call: Select an option by path + Manage selected option Commands: - dict Convert config and option to tiramisu format - find Find an or a list of options - list List options (by default list only option) - name get the name - updates Updates value with tiramisu format + dependencies Get dependencies from this option + description Get option description + dict Convert config and option to tiramisu format + extra Get de option extra + followers Get the followers option for a leadership + get Get Tiramisu option + group_type Get type for an optiondescription (only for optiondescription) + has_dependency Test if option has dependency + identifiers Get identifiers for dynamic option + index Get index of option + isdynamic Test if option is a dynamic optiondescription + isfollower Test if option is a follower + isleader Test if option is a leader + isleadership Test if option is a leader or a follower + ismulti Test if option could have multi value + isoptiondescription Test if option is an optiondescription + issubmulti Test if option could have submulti value + issymlinkoption Test if option is a symlink option + leader Get the leader option for a leadership or a follower option + list List options inside an option description (by default list only option) + name Get option name + option For OptionDescription get sub option, for symlinkoption get the linked option + path Get option path + pattern Get the option pattern + type Get de option type + updates Updates value with tiramisu format Finaly, let's print the :class:`Config`. @@ -123,7 +142,7 @@ Finaly, let's print the :class:`Config`. .. code-block:: bash - + :download:`download the getting started code ` diff --git a/docs/dynoptiondescription.rst b/docs/dynoptiondescription.rst index a9bc6dc..3d5b932 100644 --- a/docs/dynoptiondescription.rst +++ b/docs/dynoptiondescription.rst @@ -25,26 +25,32 @@ Dynamic option description is an :class:`OptionDescription` which multiplies acc Note:: the option can be an :doc:`option` or an other option description - * - suffixes - - Suffixes is a :doc:`calculation` that return the list of suffixes used to create dynamic option description. + * - identifiers + - Identifiers is a :doc:`calculation` that return the list of identifiers used to create dynamic option description. * - properties - A list of :doc:`property` (inside a frozenset(). + * - informations + - We can add default informations to this option description. + + * - group_type + - Type for this group. + Example ============== Let's try: >>> from tiramisu import StrOption, DynOptionDescription, Calculation ->>> def return_suffixes(): +>>> def return_identifiers(): ... return ['1', '2'] >>> child1 = StrOption('first', 'First basic option ') >>> child2 = StrOption('second', 'Second basic option ') >>> DynOptionDescription('basic ', ... 'Basic options ', ... [child1, child2], -... Calculation(return_suffixes)) +... Calculation(return_identifiers)) This example will construct: diff --git a/docs/leadership.rst b/docs/leadership.rst index f70afee..5242ef6 100644 --- a/docs/leadership.rst +++ b/docs/leadership.rst @@ -35,6 +35,9 @@ The leadership * - properties - A list of :doc:`property` (inside a frozenset(). + * - informations + - We can add default informations to this option description. + Example ==================== diff --git a/docs/option.rst b/docs/option.rst index 0ebb5be..bada4d3 100644 --- a/docs/option.rst +++ b/docs/option.rst @@ -18,9 +18,6 @@ Option * - doc - The `description` allows the user to understand where this option will be used for. - * - multi - - There are cases where it can be interesting to have a list of values rather than just one. - * - default - For each option, we can defined a default value. This value will be the value of this option until user customize it. @@ -35,14 +32,20 @@ Option The default_multi value can be a :doc:`calculation`. + * - multi + - There are cases where it can be interesting to have a list of values rather than just one. + * - validators - A list of :doc:`validator`. + * - properties + - A list of :doc:`property` (inside a frozenset(). + * - warnings_only - Only emit warnings if not type validation is invalid. - * - properties - - A list of :doc:`property` (inside a frozenset(). + * - informations + - We can add default informations to this option. Examples diff --git a/docs/optiondescription.rst b/docs/optiondescription.rst index 2fb6e82..5966eed 100644 --- a/docs/optiondescription.rst +++ b/docs/optiondescription.rst @@ -25,6 +25,12 @@ Option description * - properties - A list of :doc:`property` (inside a frozenset(). + * - informations + - We can add default informations to this option description. + + * - group_type + - Type for this group. + Examples ============== diff --git a/docs/options.rst b/docs/options.rst index 24acf58..5452326 100644 --- a/docs/options.rst +++ b/docs/options.rst @@ -103,7 +103,7 @@ Network options - * - BroadcastOption - - The last address within a network broadcast transmission to all hosts on the link. This option allow you to enter a broadcast: + - The last address within a network broadcast transmission to all hosts on the link. This option allow you to enter a broadcast. - * - PortOption @@ -114,6 +114,10 @@ Network options - allow_wellknown: by default, the well-known ports (also known as system ports) those from 1 through 1023 are allowed, you can disabled it - allow_registred: by default, the registered ports are those from 1024 through 49151 are allowed, you can disabled it - allow_private: allow dynamic or private ports, which are those from 49152 through 65535, one common use for this range is for ephemeral ports + - allow_protocol: allow to define protocol in value, it should be something like tcp:80 or udp:53 + + * - MACOption + - MAC address for a network card. Examples @@ -276,18 +280,32 @@ Unix options * - Type - Comments + - Extra parameters * - UsernameOption - An unix username option is a 32 characters maximum length with lowercase ASCII characters, number, '_' or '-'. The username have to start with lowercase ASCII characters or "_". + - * - GroupnameOption - Same conditions has username + - * - PasswordOption - Simple string with no other restriction: + - * - FilenameOption - For this option, only lowercase and uppercas ASCII character, "-", ".", "_", "~", and "/" are allowed. + - + - allow_relative: filename should starts with "/" (something like /etc/passwd), we can, with this option to allow relative name + - test_existence: file or directory should exists + - types + - file: it should be a file + - directory: it should be a directory + + * - PermissionsOption + - Permissions for Unix file. It could be something like 644 or 1644. + - >>> from tiramisu import UsernameOption >>> UsernameOption('user', 'user', 'my_user') diff --git a/docs/src/getting_started.py b/docs/src/getting_started.py index 5b89b95..7afde2d 100644 --- a/docs/src/getting_started.py +++ b/docs/src/getting_started.py @@ -14,6 +14,6 @@ cfg = Config(descr) # the global help about the config cfg.help() # help about an option -cfg.option.help() +cfg.option("bool").help() # the config's __repr__ print(cfg) diff --git a/tests/test_requires.py b/tests/test_requires.py index 50ac319..35c272f 100644 --- a/tests/test_requires.py +++ b/tests/test_requires.py @@ -427,8 +427,7 @@ def test_requires_transitive_unrestraint(config_type): if config_type == 'tiramisu-api': cfg.send() assert cfg_ori.option('activate_service_web').property.get() == {'disabled'} - print('FIXME') -# assert cfg_ori.unrestraint.option('ip_address_service_web').property.get() == {'disabled'} + # FIXME assert cfg_ori.unrestraint.option('ip_address_service_web').property.get() == {'disabled'} assert cfg_ori.option('ip_address_service_web').property.get() == {'disabled'} # assert not list_sessions()