getArgv() public static method

Return the cmd line arguments passed for the Fantom launcher code.
public static getArgv ( ) : string[]
return string[]
Ejemplo n.º 1
0
        //////////////////////////////////////////////////////////////////////////
        // Run
        //////////////////////////////////////////////////////////////////////////

        public static int run(string reserved)
        {
            try
            {
                sysInit(reserved);

                // process args
                string[] args = Tool.getArgv();
                for (int i = 0; i < args.Length; i++)
                {
                    string a = args[i];
                    if (a.Length == 0)
                    {
                        continue;
                    }
                    if (a == "-help" || a == "-h" || a == "-?")
                    {
                        help();
                        return(2);
                    }
                    else if (a == "-version")
                    {
                        version("Fantom Launcher");
                        return(3);
                    }
                    else if (a == "-pods")
                    {
                        pods("Fantom Launcher");
                        return(4);
                    }
                    else if (a[0] == '-')
                    {
                        writeLine("WARNING: Unknown option " + a);
                    }
                    else
                    {
                        string   target     = a;
                        string[] targetArgs = new string[args.Length - i - 1];
                        Array.Copy(args, i + 1, targetArgs, 0, targetArgs.Length);
                        return(new Fan().execute(target, targetArgs));
                    }
                }

                help();
                return(2);
            }
            catch (Exception e)
            {
                Err.dumpStack(e);
                return(1);
            }
        }
Ejemplo n.º 2
0
        //////////////////////////////////////////////////////////////////////////
        // Run Methods
        //////////////////////////////////////////////////////////////////////////

        public static int run(string reserved)
        {
            try
            {
                sysInit(reserved);
                SysProps.putProperty("fan.appDir", "$home/tmp/test/");

                //bool self = false;
                bool      verbose = false;
                ArrayList targets = new ArrayList();

                string[] args = Tool.getArgv();
                if (args.Length == 0)
                {
                    help(); return(-1);
                }

                // process args
                for (int i = 0; i < args.Length; i++)
                {
                    string a = args[i];
                    if (a.Length == 0)
                    {
                        continue;
                    }
                    if (a == "-help" || a == "-h" || a == "-?")
                    {
                        help();
                        return(-1);
                    }
                    if (a == "-version")
                    {
                        Fan.version("Fantom Test");
                        return(-1);
                    }
                    else if (a == "-v")
                    {
                        verbose            = true;
                        FanSysTest.verbose = true;
                        //fanx.test.Test.verbose = true;
                    }
                    else if (a == "-all")
                    {
                        targets.Add("*");
                    }
                    else if (a[0] == '-')
                    {
                        writeLine("WARNING: Unknown option " + a);
                    }
                    else
                    {
                        targets.Add(a);
                    }
                }

                if (targets.Count == 0)
                {
                    help(); return(-1);
                }

                string[] t = (string[])targets.ToArray(System.Type.GetType("System.String"));
                return(new Fant().test(t, verbose));
            }
            catch (System.Exception e)
            {
                Err.dumpStack(e);
                return(-1);
            }
        }
Ejemplo n.º 3
0
        //////////////////////////////////////////////////////////////////////////
        // Run
        //////////////////////////////////////////////////////////////////////////

        public static int run(string reserved)
        {
            sysInit(reserved);

            try
            {
                ArrayList     pods    = new ArrayList();
                DirectoryInfo outDir  = new DirectoryInfo(".");
                bool          verbose = false;

                string[] args = Tool.getArgv();
                if (args.Length == 0)
                {
                    help(); return(-1);
                }

                // process args
                for (int i = 0; i < args.Length; i++)
                {
                    string a = args[i];
                    if (a.Length == 0)
                    {
                        continue;
                    }
                    if (a == "-help" || a == "-h" || a == "-?")
                    {
                        help();
                        return(-1);
                    }
                    else if (a == "-v")
                    {
                        verbose = true;
                    }
                    else if (a == "-d")
                    {
                        if (i + 1 >= args.Length)
                        {
                            writeLine("ERROR: must specified dir with -d option");
                            return(-1);
                        }
                        outDir = new DirectoryInfo(args[++i]);
                    }
                    else if (a[0] == '-')
                    {
                        writeLine("WARNING: Unknown option " + a);
                    }
                    else
                    {
                        pods.Add(a);
                    }
                }

                if (pods.Count == 0)
                {
                    help(); return(-1);
                }

                for (int i = 0; i < pods.Count; i++)
                {
                    stub((string)pods[i], outDir, verbose);
                }
                return(0);
            }
            catch (System.Exception e)
            {
                Err.dumpStack(e);
                return(-1);
            }
        }
Ejemplo n.º 4
0
        //////////////////////////////////////////////////////////////////////////
        // Run
        //////////////////////////////////////////////////////////////////////////

        public static int run(string reserved)
        {
            sysInit(reserved);
            return(new Fan().execute("compiler::Fanp.main", Tool.getArgv()));
        }