Exemplo n.º 1
0
        /// <summary>
        /// The entrypoint for a single command within the command-line application.
        /// </summary>
        public CliCommand()
        {
            Type              = GetType();
            _isAppRoot        = Type.IsSubclassOf(typeof(CliApp));
            _optionsAttribute = Type.GetCustomAttribute <CliOptionsAttribute>();

            var allProps = Type.GetProperties(BindingFlags.Public | BindingFlags.Instance);

            ConfigurationProperties = allProps.GetConfigProperties().ToArray();
            CommandProperties       = allProps.GetCommandProperties().ToArray();
            _implicitBoolProperties = ConfigurationProperties
                                      .Where(p => p.PropertyType == typeof(bool) && !p.HasAttribute <CliExplicitBoolAttribute>())
                                      .ToArray();
        }