예제 #1
0
        public IEnumerable <string> GetCodeItems(OptionPreference preferLongNames = OptionPreference.Short)
        {
            // --verbose: Show more output
            if ((Flags & DockerComposeCommonFlags.Verbose) != 0)
            {
                yield return("--verbose");
            }
            // --no-ansi: Do not print ANSI control characters
            if ((Flags & DockerComposeCommonFlags.NoAnsi) != 0)
            {
                yield return("--no-ansi");
            }
            // -v, --version: Print version and exit
            if ((Flags & DockerComposeCommonFlags.Version) != 0)
            {
                yield return(preferLongNames == OptionPreference.Long ? "--version" : "-v");
            }
            // --tls: Use TLS; implied by --tlsverify
            if ((Flags & DockerComposeCommonFlags.Tls) != 0)
            {
                yield return("--tls");
            }
            // --tlsverify: Use TLS and verify the remote
            if ((Flags & DockerComposeCommonFlags.Tlsverify) != 0)
            {
                yield return("--tlsverify");
            }
            // --skip-hostname-check: Don't check the daemon's hostname against the name specified in the client certificate
            if ((Flags & DockerComposeCommonFlags.SkipHostnameCheck) != 0)
            {
                yield return("--skip-hostname-check");
            }
            // --compatibility: If set, Compose will attempt to convert deploy keys in v3 files to their non-Swarm equivalent
            if ((Flags & DockerComposeCommonFlags.Compatibility) != 0)
            {
                yield return("--compatibility");
            }
            // -f, --file =FILE: Specify an alternate compose file (default: docker-compose.yml)
            if (!string.IsNullOrEmpty(File))
            {
                yield return("--file");

                yield return(File.ShellQuote());
            }
            // -p, --project-name =NAME: Specify an alternate project name (default: directory name)
            if (!string.IsNullOrEmpty(ProjectName))
            {
                yield return("--project-name");

                yield return(ProjectName.ShellQuote());
            }
            // --log-level =LEVEL: Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
            if (!(LogLevel is null))
            {
                yield return("--log-level");

                yield return(LogLevel.Value.ToLinuxValue());
            }
            // -H, --host =HOST: Daemon socket to connect to
            if (!string.IsNullOrEmpty(Host))
            {
                yield return("--host");

                yield return(Host.ShellQuote());
            }
            // --tlscacert =CA_PATH: Trust certs signed only by this CA
            if (!string.IsNullOrEmpty(Tlscacert))
            {
                yield return("--tlscacert");

                yield return(Tlscacert.ShellQuote());
            }
            // --tlscert =CLIENT_CERT_PATH: Path to TLS certificate file
            if (!string.IsNullOrEmpty(Tlscert))
            {
                yield return("--tlscert");

                yield return(Tlscert.ShellQuote());
            }
            // --tlskey =TLS_KEY_PATH: Path to TLS key file
            if (!string.IsNullOrEmpty(Tlskey))
            {
                yield return("--tlskey");

                yield return(Tlskey.ShellQuote());
            }
            // --project-directory =PATH: Specify an alternate working directory (default: the path of the Compose file)
            if (!string.IsNullOrEmpty(ProjectDirectory))
            {
                yield return("--project-directory");

                yield return(ProjectDirectory.ShellQuote());
            }
        }