From 4e57ca6833bf1b2cd733017f7ef7db398b8d5ab8 Mon Sep 17 00:00:00 2001 From: Danny McClanahan Date: Wed, 19 Jul 2017 18:25:06 -0500 Subject: [PATCH] [CS2] Add #! support for executable scripts on Linux. (#3946) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add #! support for executable scripts on Linux. Pass arguments to executable script unchanged if using "#!/usr/bin/env coffee". (Previously, "./test.coffee -abck" would be turned into "-a -b -c -k", for example.) Fixes #1752. * refactor option parsing clean up parsing code and in the process fix oustanding bug where coffeescript modified arguments meant for an executable script * address comments * intermediate save * add note saying where OptionParser is used in coffee command * add some more work * fix flatten functions * refactor tests * make argument processing less confusing * add basic test * remove unused file * compilation now hangs * remove unnecessary changes * add tests!!! * add/fix some tests * clarify a test * fix helpers * fix opt parsing * fix infinite loop * make rule building easier to read * add tests for flag overlap * revamp argument parsing again and add more thorough testing * add tests, comment, clean unused method * address review comments * add test for direct invocation of shebang scripts * move shebang parsing test to separate file and check for browser * remove TODO * example backwards compatible warnings * add correct tests for warning 1 * add tests for warnings * commit output js libs and update docs * respond to review comments also add tests for help text * respond to review comments * fix example output * Rewrite argument parsing documentation to be more concise; add it to sidebar and body; add new output * Don’t mention deprecated syntax; clean up variable names --- docs/v2/index.html | 38 +++- ...nges_argument_parsing_and_shebang_lines.md | 34 ++++ ...he_less_than_and_greater_than_operators.md | 2 +- documentation/sections/coffeescript_2.md | 2 +- documentation/v2/body.html | 3 + documentation/v2/docs.css | 4 +- documentation/v2/sidebar.html | 3 + lib/coffeescript/coffeescript.js | 17 +- lib/coffeescript/command.js | 17 +- lib/coffeescript/optparse.js | 189 +++++++++++------- src/coffeescript.coffee | 15 ++ src/command.coffee | 19 +- src/optparse.coffee | 146 +++++++++----- test/argument-parsing.coffee | 75 ------- test/argument_parsing.coffee | 142 +++++++++++++ test/importing/shebang.coffee | 3 + test/importing/shebang_extra_args.coffee | 3 + test/importing/shebang_initial_space.coffee | 3 + .../shebang_initial_space_extra_args.coffee | 3 + test/invocation_argument_parsing.coffee | 108 ++++++++++ test/option_parser.coffee | 57 +++++- test/support/helpers.coffee | 2 + 22 files changed, 672 insertions(+), 213 deletions(-) create mode 100644 documentation/sections/breaking_changes_argument_parsing_and_shebang_lines.md delete mode 100644 test/argument-parsing.coffee create mode 100644 test/argument_parsing.coffee create mode 100755 test/importing/shebang.coffee create mode 100755 test/importing/shebang_extra_args.coffee create mode 100755 test/importing/shebang_initial_space.coffee create mode 100644 test/importing/shebang_initial_space_extra_args.coffee create mode 100644 test/invocation_argument_parsing.coffee diff --git a/docs/v2/index.html b/docs/v2/index.html index 5ddc172c..ac291e2b 100644 --- a/docs/v2/index.html +++ b/docs/v2/index.html @@ -306,7 +306,7 @@ td code { white-space: nowrap; } -h2, h3 { +h2, h3, h4 { margin-top: 1.3em; margin-bottom: 0.6em; font-family: 'Alegreya Sans'; @@ -314,7 +314,7 @@ h2, h3 { h2 { font-weight: 800; } -h3, h2 time { +h3, h4, h2 time { font-weight: 400; } @@ -734,6 +734,9 @@ textarea { +