/*
 * [TestCommandLineQuoting.java]
 *
 * Summary: Test the way the command line modifies parameters.
 *
 * Copyright: (c) 2014-2017 Roedy Green, Canadian Mind Products, http://mindprod.com
 *
 * Licence: This software may be copied and used freely for any purpose but military.
 *          http://mindprod.com/contact/nonmil.html
 *
 * Requires: JDK 1.8+
 *
 * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/
 *
 * Version History:
 *  1.0 2014-06-29 initial version
 */
package com.mindprod.example;

import static java.lang.System.*;

/**
 * Test the way the command line modifies parameters.
 *
 * @author Roedy Green, Canadian Mind Products
 * @version 1.0 2014-06-29 initial version
 * @since 2014-06-29
 */
@SuppressWarnings( { "UnusedAssignment" } )
public final class TestCommandLineQuoting
    {
    /**
     * Test Command Line
     *
     * @param args Various variants
     */
    public static void main( String[] args )
        {
        for ( int i = 0; i < args.length; i++ )
            {
            out.println( i + " [" + args[ i ] + "]" );
            }
        }
    // R E S U L T S
    // abc def
    // gives:
    // 0 [abc]
    // 1 [def]
    // rule: space separates parms.
    // "ab de"  'fg hi'
    // gives:
    // 0 [ab de]
    // 1 ['fg]
    // 2 [hi']
    // rule: Use "s to enclose a parm with spaces in it.
    // rule: ' is treated like any alphabetic character.
    // "ab\"ef"  "fg""hi"
    // gives:
    // 0 [ab"ef]
    // 1 [fghi]
    // rule: put a \ before a " inside a parm.
    // rule: doubling a quote inside a parm does not work.
    // "E:\ab\ef\n\r\x.html"
    // gives:
    // 0 [E:\ab\ef\n\r\x.html]
    // rule: Windows filenames enclosed in "s containing \ work fine.
    // "\\"
    // 0 [\]
    // rule: as in Java String literals, \\ becomes \.  To get \\ you need \\\\.
    }