Exemple #1
0
        private static void Add_Curl(EnumsGenerator enumsGenerator)
        {
            // SOURCE https://man7.org/linux/man-pages/man1/tar.1.html
            const string desc1 = @"
-f  <tar-archive> / $archive-file-name
Archive

-z/ --gzip
    Filter the archive through gzip(1).

-Z/ --compress
    Filter the archive through compress(1).

-v / $Verbose
Verbose

";

            var item = enumsGenerator
                       .WithEnum("Tar", desc1, ParserKind.Style1)
                       .WithStringValue("-f", "")
                       .WithConflict("--gzip", "--compress");


            item.Names.OptionsContainerClassName = nameof(TarCommand);
            CommonSetup(item);
        }
        public void Enum_Test()
        {
            var s = EnumsGenerator.GenerateEnumItems(@"Credit to Prepaid meter Retrofit
Disconnection - OHM
Disconnection - UGM
Hard disconnection at CDU (Single phase)
Hard disconnection at CDU (Three phase)
Hard disconnection at the pole (Single phase)
Hard disconnection at the pole (Three phase)
Hard reconnection at CDU (Single phase)
Hard reconnection at CDU (Three phase)
Hard reconnection at the pole (Single phase)
Hard reconnection at the pole (Three phase)
Keypad Replacemnt (PLC/SMART)
Keypad Replacemt (wired comms wires)
Meter Replacements (Single phase)
Meter Replacements (Three phase)
Normal Disconnection (Single or Three phase)
Normal Reconnection (Single or Three phase)
PLC Meter Changes
Reconnection - OHM
Reconnection - UGM
Remove Meter
Remove all Gear - RAG
Replacement of a fuse base and carrier with similar or circuit breaker.
Replacement of a split meter
Service Cable Removal - SCR
Site Call
Special hard Disconnection
Split meter conversion");
        }
 public static void Add(EnumsGenerator enumsGenerator)
 {
     Add_UpOptions(enumsGenerator);
     Add_ConfigOptions(enumsGenerator);
     Add_BuildOptions(enumsGenerator);
     Add_PortOptions(enumsGenerator);
     Add_Common(enumsGenerator);
 }
Exemple #4
0
        private static EnumsGenerator GetEnumsGenerator()
        {
            var enumsGenerator = new EnumsGenerator(AllGenerators.GetDirectoryProvider())
                                 .WithTargetAssembly <Sha1Code>();

            UseraddSetup.Add(enumsGenerator);
            TarSetup.Add(enumsGenerator);
            CurlSetup.Add(enumsGenerator);
            UnzipSetup.Add(enumsGenerator);
            DockerComposeSetup.Add(enumsGenerator);
            return(enumsGenerator);
        }
        private static void Add_PortOptions(EnumsGenerator enumsGenerator)
        {
            const string optionsToParse = @"
    --protocol=proto  tcp or udp [default: tcp]
    --index=index     index of the container if there are multiple
                      instances of a service [default: 1]
";
            var          item           = enumsGenerator
                                          .WithEnum("Docker.DockerComposePort", optionsToParse)
                                          .WithIntegerValue("--index")
                                          .WithEnumValue("--protocol", "tcp,udp".Split(','));

            item.Tags["name"] = "port";
            CommonSetup(item);
        }
Exemple #6
0
        private static void Add_Unzip(EnumsGenerator enumsGenerator)
        {
            // https://linux.die.net/man/1/unzip
            // unzip [-Z] [-cflptTuvz[abjnoqsCDKLMUVWX$/:^]] file[.zip] [file(s) ...] [-x xfile(s) ...] [-d exdir]
            const string desc = @"
-x exclude            An optional list of archive members to be excluded from processing.
-d $output-directory  An optional directory to which to extract files.
-o, $overwrite        Overwrite existing files without prompting.
";
            var          item = enumsGenerator
                                .WithEnum("Unzip", desc);

            item.WithStringValue("-d", "Output directory");
            item.WithStringValue("-x", "Items to exclude", true);
            CommonSetup(item);
        }
Exemple #7
0
        static void Main(string[] args)
        {
            var        name   = "t_to_gen.json";
            FileReader reader = new FileReader();

            reader.Read(name);
            var emuns = EnumsGenerator.Generate(reader.enumerators);
            var table = TableGenerator.Generate(EnumsGenerator.arrays, "SimpleTable");

            Console.WriteLine(table);

            using (var textWriter = new StreamWriter(name + "asdas", false, Encoding.ASCII))
            {
                textWriter.WriteLine(emuns);
                textWriter.WriteLine(table);
            }
        }
        private static void Add_BuildOptions(EnumsGenerator enumsGenerator)
        {
            const string optionsToParse = @"
    --build-arg key=val     Set build-time variables for services.
    --compress              Compress the build context using gzip.
    --force-rm              Always remove intermediate containers.
    -m, --memory MEM        Set memory limit for the build container.
    --no-cache              Do not use cache when building the image.
    --no-rm                 Do not remove intermediate containers after a successful build.
    --parallel              Build images in parallel.
    --progress string       Set type of progress output (`auto`, `plain`, `tty`).
    --pull                  Always attempt to pull a newer version of the image.
    -q, --quiet             Don't print anything to `STDOUT`.";
            var          item           = enumsGenerator
                                          .WithEnum("Docker.DockerComposeBuild", optionsToParse);

            item.Tags["name"] = "build";
            CommonSetup(item);
        }
        private static void Add_UpOptions(EnumsGenerator enumsGenerator)
        {
            const string optionsToParse = @"
    -d, --detach               Detached mode: Run containers in the background,
                               print new container names. Incompatible with
                               --abort-on-container-exit.
    --no-color                 Produce monochrome output.
    --quiet-pull               Pull without printing progress information
    --no-deps                  Don't start linked services.
    --force-recreate           Recreate containers even if their configuration
                               and image haven't changed.
    --always-recreate-deps     Recreate dependent containers.
                               Incompatible with --no-recreate.
    --no-recreate              If containers already exist, don't recreate
                               them. Incompatible with --force-recreate and 
                               --renew-anon-volumes.
    --no-build                 Don't build an image, even if it's missing.
    --no-start                 Don't start the services after creating them.
    --build                    Build images before starting containers.
    --abort-on-container-exit  Stops all containers if any container was
                               stopped. Incompatible with --detach.
    --attach-dependencies      Attach to dependent containers.
    -t, --timeout TIMEOUT      Use this timeout in seconds for container
                               shutdown when attached or when containers are
                               already running. (default: 10)
    -V, --renew-anon-volumes   Recreate anonymous volumes instead of retrieving
                               data from the previous containers.
    --remove-orphans           Remove containers for services not defined
                               in the Compose file.
    --exit-code-from SERVICE   Return the exit code of the selected service
                               container. Implies --abort-on-container-exit.
    --scale SERVICE=NUM        Scale SERVICE to NUM instances. Overrides the
                               `scale` setting in the Compose file if present.";
            var          item           = enumsGenerator
                                          .WithEnum("Docker.DockerComposeUp", optionsToParse)
                                          .WithIntegerValue("--scale")
                                          .WithIntegerValue("--timeout", "timeout in seconds")
                                          .WithStringValue("--exit-code-from", "service name");

            item.Tags["name"] = "up";
            CommonSetup(item);
        }
        private static void Add_ConfigOptions(EnumsGenerator enumsGenerator)
        {
            const string optionsToParse = @"
    --resolve-image-digests  Pin image tags to digests.
    --no-interpolate         Don't interpolate environment variables.
    -q, --quiet              Only validate the configuration, don't print
                             anything.
    --services               Print the service names, one per line.
    --volumes                Print the volume names, one per line.
    --hash=servicesOrWild    Print the service config hash, one per line.
                             Set ""service1,service2"" for a list of specified services
                             or use the wildcard symbol to display all services.
";
            var          item           = enumsGenerator
                                          .WithEnum("Docker.DockerComposeConfig", optionsToParse)
                                          .WithStringValue("--hash", "services");

            item.Tags["name"] = "config";
            CommonSetup(item);
        }
        private static void Add_Common(EnumsGenerator enumsGenerator)
        {
            const string optionsToParse = @"
  -f, --file FILE             Specify an alternate compose file
                              (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name
                              (default: directory name)
  --verbose                   Show more output
  --log-level LEVEL           Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  --no-ansi                   Do not print ANSI control characters
  -v, --version               Print version and exit
  -H, --host HOST             Daemon socket to connect to

  --tls                       Use TLS; implied by --tlsverify
  --tlscacert CA_PATH         Trust certs signed only by this CA
  --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
  --tlskey TLS_KEY_PATH       Path to TLS key file
  --tlsverify                 Use TLS and verify the remote
  --skip-hostname-check       Don't check the daemon's hostname against the
                              name specified in the client certificate
  --project-directory PATH    Specify an alternate working directory
                              (default: the path of the Compose file)
  --compatibility             If set, Compose will attempt to convert deploy
                              keys in v3 files to their non-Swarm equivalent
";
            var          item           = enumsGenerator
                                          .WithEnum("Docker.DockerComposeCommon", optionsToParse)
                                          .WithStringValue("--file", "alternate compose file")
                                          .WithEnumValue("--log-level", "DEBUG, INFO, WARNING, ERROR, CRITICAL".Split(","))
                                          .WithStringValue("--tlscacert", "Trust certs signed only by this CA")
                                          .WithStringValue("--tlscert", "Path to TLS certificate file")
                                          .WithStringValue("--tlskey", "Path to TLS key file")
                                          .WithStringValue("--project-name", "alternate project name")
                                          .WithStringValue("--host", "daemon socket to connect to")
                                          .WithStringValue("--project-directory", "alternate working directory");

            CommonSetup(item);
        }
Exemple #12
0
 public static void Add(EnumsGenerator enumsGenerator)
 {
     Add_Unzip(enumsGenerator);
 }
Exemple #13
0
 public static void Add(EnumsGenerator enumsGenerator)
 {
     Add_Curl(enumsGenerator);
 }
Exemple #14
0
        private static void Add_Curl(EnumsGenerator enumsGenerator)
        {
            /*
             * SOURCE https://linux.die.net/man/8/useradd
             *          useradd [options] LOGIN
             *          useradd -D
             *          useradd -D [options]
             */
            const string desc1 = @"

-b/--base-dir <BASE_DIR>
BASE_DIR is concatenated with the account name to define the home directory. 

-c/ --comment <COMMENT>
Any text string.

-d/ --home <HOME_DIR>
The new user will be created using HOME_DIR as the value for the user's login directory.

-g/ --gid <GROUP>
The group name or number of the user's initial login group. The group name must exist.


-K/ --key <KEY=VALUE>
Overrides /etc/login.defs defaults (UID_MIN, UID_MAX, UMASK, PASS_MAX_DAYS and others)

-l/ --no-log-init
Do not add the user to the lastlog and faillog databases.

-m/ --create-home
Create the user's home directory if it does not exist.

-M/ $Do-not-create-home-directory
Do not create the user's home directory, even if the system wide setting from /etc/login.defs (CREATE_HOME) is set to yes.


-N/ --no-user-group
Do not create a group with the same name as the user, but add the user to the group specified by the -g option or by the GROUP variable in /etc/default/useradd.

 
-o/ --non-unique
Allow the creation of a user account with a duplicate (non-unique) UID.

-p/ --password <PASSWORD>
The encrypted password, as returned by crypt(3). The default is to disable the password.

-r/ --system
Create a system account. 

-s/ --shell <SHELL>
The name of the user's login shell. The default is to leave this field blank, which causes the system to select the default login shell specified by the SHELL variable in /etc/default/useradd, or an empty string by default.

-u/ --uid <UID>
The numerical value of the user's ID. This value must be unique, unless the -o option is used. The value must be non-negative. The default is to use the smallest ID value greater than 999 and greater than every other user. Values between 0 and 999 are typically reserved for system accounts.

-U/ --user-group
Create a group with the same name as the user, and add the user to this group.
The default behavior (if the -g, -N, and -U options are not specified) is defined by the USERGROUPS_ENAB variable in /etc/login.defs.

-Z/ --selinux-user <SEUSER>
The SELinux user for the user's login. The default is to leave this field blank, which causes the system to select the default SELinux user.
";

            var item = enumsGenerator
                       .WithEnum("UserAdd", desc1, ParserKind.Style1)
                       .WithStringValue("-b", "base dir")
                       .WithStringValue("-c", "comment")

                       .WithStringValue("-d", "home directory")
                       .WithStringValue("-g", "group")

                       .WithStringValue("-K", "value")
                       .WithStringValue("-p", "password")

                       .WithConflict("-m", "-M")
            ;


            item.Names.OptionsContainerClassName = nameof(UserAddCommand);
            CommonSetup(item);
        }
Exemple #15
0
        private static void Add_Curl(EnumsGenerator enumsGenerator)
        {
            // SOURCE https://www.mit.edu/afs.new/sipb/user/ssen/src/curl-7.11.1/docs/curl.html
            const string desc = @"
-a/--append
When used in an FTP upload, this will tell curl to append to the target file instead of overwriting it.

-A/--user-agent <agent string>
Specify the User-Agent string to send to the HTTP server.

--anyauth
Tells curl to figure out authentication method by itself, and use the most secure one the remote site claims it supports.

-b/--cookie <name=$cookie value>
 Pass the data to the HTTP server as a cookie. 

-B/--use-ascii
Use ASCII transfer when getting an FTP file or LDAP info.

--basic
Tells curl to use HTTP Basic authentication. 

--ciphers <list of ciphers>

Specifies which ciphers to use in the connection.

--compressed
Request a compressed response using one of the algorithms libcurl supports, and return the uncompressed document


--connect-timeout <seconds>
Maximum time in seconds that you allow the connection to the server to take. 


-c/--cookie-jar <file name>
Specify to which file you want curl to write all cookies after a completed operation.

-C/--continue-at <offset>
Continue/Resume a previous file transfer at the given offset.

--create-dirs
When used in conjunction with the -o option, curl will create the necessary local directory hierarchy as needed. 

--crlf
(FTP) Convert LF to CRLF in upload.

 
-d/--data <data>
(HTTP) Sends the specified data in a POST request to the HTTP server, in a way that can emulate as if a user has filled in a HTML form and pressed the submit button.


--data-binary <data>
(HTTP) This posts data in a similar manner as --data-ascii does, although when using this option the entire context of the posted data is kept as-is.

--digest
(HTTP) Enables HTTP Digest authentication.

--disable-epsv
(FTP) Tell curl to disable the use of the EPSV command when doing passive FTP transfers.


-D/--dump-header <fileName>/$dump-header-file-name
Write the protocol headers to the specified file.  

-e/--referer <referer page url>
(HTTP) Sends the ""Referer Page"" information to the HTTP server.

--egd-file <fileName>
(HTTPS) Specify the path name to the Entropy Gathering Daemon socket.

--cert-type <type>
(SSL) Tells curl what certificate type the provided certificate is in. PEM, DER and ENG are recognized types.

--cacert <CA certificate>
(HTTPS) Tells curl to use the specified certificate file to verify the peer.

--capath <CA certificate directory>
(HTTPS) Tells curl to use the specified certificate directory to verify the peer. 

-f/--fail
(HTTP) Fail silently (no output at all) on server errors.

--ftp-create-dirs
(FTP) When an FTP URL/operation uses a path that doesn't currently exist on the server, the standard behavior of curl is to fail.


--ftp-pasv
(FTP) Use PASV when transfering.

--ftp-ssl
(FTP) Make the FTP connection switch to use SSL/TLS.


-F/--form <name=content>
(HTTP) This lets curl emulate a filled in form in which a user has pressed the submit button.

-g/--globoff
This option switches off the ""URL globbing parser"". 

-G/--get
When used, this option will make all data specified with -d/--data or --data-binary to be used in a HTTP GET request instead of the POST request that otherwise would be used.


-H/--header <header>
(HTTP) Extra header to use when getting a web page. 


-i/--include
(HTTP) Include the HTTP-header in the output. 

-I/--head
(HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers feature the command HEAD which this uses to get nothing but the header of a document.

-j/--junk-session-cookies
(HTTP) When curl is told to read cookies from a given file, this option will make it discard all ""session cookies"".

 -k/--insecure
(SSL) This option explicitly allows curl to perform ""insecure"" SSL connections and transfers.
 
--key <Private key file name>
(SSL) Private key file name


-K/--config <config file>
Specify which config file to read curl arguments from. 

--limit-rate <speed>
Specify the maximum transfer rate you want curl to use.

-l/--list-only
(FTP) When listing an FTP directory, this switch forces a name-only view. 

-L/--location
(HTTP/HTTPS) If the server reports that the requested page has a different location (indicated with the header line Location:) this flag will let curl attempt to reattempt the get on the new place.  

--location-trusted
(HTTP/HTTPS) Like -L/--location,

--max-filesize <bytes>
Specify the maximum size (in bytes) of a file to download. 


-m/--max-time <seconds>
Maximum time in seconds that you allow the whole operation to take. 

-o/--output <output file>/$output file
Write output to <file> instead of stdout. 

-R/--remote-time
When used, this will make libcurl attempt to figure out the timestamp of the remote file, and if that is available make the local file get that same timestamp.

-s/--silent
Silent mode. Don't show progress meter or error messages. Makes Curl mute.

-S/--show-error
When used with -s it makes curl show error message if it fails.

-T/--upload-file <file>
This transfers the specified local file to the remote URL.

--url <URL>
Specify a URL to fetch.

-v/--verbose
Makes the fetching more verbose/talkative.


-0/--http1.0
(HTTP) Forces curl to issue its requests using HTTP 1.0 instead of using its internally preferred: HTTP 1.1.

-1/--tlsv1
(HTTPS) Forces curl to use TSL version 1 when negotiating with a remote TLS server.

-2/--sslv2
(HTTPS) Forces curl to use SSL version 2 when negotiating with a remote SSL server.

-3/--sslv3
(HTTPS) Forces curl to use SSL version 3 when negotiating with a remote SSL server.

-4/--ipv4
If libcurl is capable of resolving an address to multiple IP versions (which it is if it is ipv6-capable), this option tells libcurl to resolve names to IPv4 addresses only. (Added in 7.10.8)

-6/--ipv6
If libcurl is capable of resolving an address to multiple IP versions (which it is if it is ipv6-capable), this option tells libcurl to resolve names to IPv6 addresses only. (Added in 7.10.8)

-#/--progress-bar
Make curl display progress information as a progress bar instead of the default statistics.
";

            var item = enumsGenerator
                       .WithEnum("Curl", desc, ParserKind.Style1)
                       .WithStringValue("--user-agent", "Agent")
                       .WithStringValue("-b", "cookie value")
                       .WithStringValue("--ciphers", "ciphers", true)
                       .WithIntegerValue("--connect-timeout", "timeout seconds")
                       .WithStringValue("-c", "cookies file")
                       .WithIntegerValue("--continue-at")
                       .WithStringValue("-d", "data")
                       .WithStringValue("--data-binary", "data")
                       .WithStringValue("--dump-header", "target file")
                       .WithStringValue("--referer", "referer page url")
                       .WithStringValue("--egd-file")
                       .WithEnumValue("--cert-type", "PEM,DER,ENG".Split(','))
                       .WithStringValue("--cacert")
                       .WithStringValue("--capath")
                       .WithStringValue("--form")
                       .WithStringValue("--header")
                       .WithStringValue("--key")
                       .WithStringValue("--config")
                       .WithStringValue("--limit-rate")
                       .WithIntegerValue("--max-filesize")
                       .WithIntegerValue("--max-time")
                       .WithStringValue("-o")
                       .WithStringValue("-T")
                       .WithStringValue("--url");

            item.Names.OptionsContainerClassName = nameof(CurlCommand);
            CommonSetup(item);
            // add support for -E, --interface, --key-type, --krb4
            // -n/--netrc, --netrc-optional
            // --negotiate, -N/--no-buffer --ntlm
            // -O/--remote-name
            // --pass <phrase>
            // --proxy-ntlm
            // -p/--proxytunnel
            // -P/--ftp-port <address>
            // -q
            // -Q/--quote <comand>
            // --random-file <file>
            // -r/--range <range>
            // --socks <host[:port]>, --stderr <file>, -t/--telnet-option <OPT=val>
            // --trace <file>, --trace-ascii <file>,
            // -u/--user <user:password>, -U/--proxy-user <user:password>
            // -w/--write-out <format>
            // -x/--proxy <proxyhost[:port]>
            // -X/--request <command>
            // -y/--speed-time <time>
            // -Y/--speed-limit <speed>
            // -z/--time-cond <date expression>
            // -Z/--max-redirs <num>
        }