Repository: bokeh/bokeh

Issue:
[BUG] Error in the bokeh --serve documentation
#### Versions:
- Bokeh: 1.1.0
- Python: 3.5.2
- OS: Ubuntu 16.04 LTS
- Browser: Google Chrome 74.0.3729.131

#### Description of expected behavior and the observed behavior
According to `bokeh serve --help` it should be possible to start a Bokeh server with this command:
`bokeh serve --dev script.py` but this throws an error. It won't throw an error if this order is used: `bokeh serve script.py --dev`. I think this is because it sees script.py as an argument of the --dev option. This could be fixed by editing the `bokeh serve --help` documentation and moving the directory or script to the first position in the usage example.
Another small issue is that some of the options for the bokeh serve command are missing on [this page](https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html) on the documentation website:
- --index
- --disable-index
- --websocket-max-message-size
- --dev


#### Error message
```
jasper@jasper-Inspiron-7548:~/Desktop$ bokeh serve --dev script.py
ERROR: list index out of range
```

https://stackoverflow.com/questions/56111167/how-to-start-bokeh-server-in-dev-mode


Discussion:
@Jasper51297 Thanks for the report, the proper fix here is to make it so the position of `--dev` works anywhere. 
So it turns out the option does have to be last, since it accepts any "left over" orgs. Unfortunately the usage example is auto-generated by argparse so I am not sure we can do anything about it. But I will add a note in the help for the individual option. 
Right so more specifically, the files accepts `nargs=*` and so does `--dev`. It works to put any other option in between, e.g.
```
bokeh serve --dev --show sliders.py
```
Becuase then argparse knows how to apportion the leftover args. I will see if  can move `--dev` up in the help list, and also add the note. 

Resolving patch:
diff --git a/bokeh/command/subcommands/serve.py b/bokeh/command/subcommands/serve.py
--- a/bokeh/command/subcommands/serve.py
+++ b/bokeh/command/subcommands/serve.py
@@ -410,7 +410,28 @@ class Serve(Subcommand):
         ('--args', dict(
             metavar='COMMAND-LINE-ARGS',
             nargs=argparse.REMAINDER,
-            help="Any command line arguments remaining are passed on to the application handler",
+            help="Command line arguments remaining to passed on to the application handler. "
+                 "NOTE: if this argument precedes DIRECTORY-OR-SCRIPT then some other argument, e.g "
+                 "--show, must be placed before the directory or script. ",
+        )),
+
+        ('--dev', dict(
+            metavar ='FILES-TO-WATCH',
+            action  ='store',
+            default = None,
+            type    = str,
+            nargs   = '*',
+            help    = "Enable live reloading during app development. "
+                      "By default it watches all *.py *.html *.css *.yaml files "
+                      "in the app directory tree. Additional files can be passed "
+                      "as arguments."
+                      "NOTE: if this argument precedes DIRECTORY-OR-SCRIPT then some other argument, e.g "
+                      "--show, must be placed before the directory or script. "
+                      "NOTE: This setting only works with a single app. "
+                      "It also restricts the number of processes to 1. "
+                      "NOTE FOR WINDOWS USERS : this option must be invoked using "
+                      "'python -m bokeh'. If not Tornado will fail to restart the "
+                      "server",
         )),
 
         ('--show', dict(
@@ -514,23 +535,6 @@ class Serve(Subcommand):
             default=DEFAULT_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES,
             type=int,
         )),
-
-        ('--dev', dict(
-            metavar ='FILES-TO-WATCH',
-            action  ='store',
-            default = None,
-            type    = str,
-            nargs   = '*',
-            help    = "Enable live reloading during app development. "
-                      "By default it watches all *.py *.html *.css *.yaml files "
-                      "in the app directory tree. Additional files can be passed "
-                      "as arguments. "
-                      "NOTE: This setting only works with a single app. "
-                      "It also restricts the number of processes to 1. "
-                      "NOTE FOR WINDOWS USERS : this option must be invoked using "
-                      "'python -m bokeh'. If not Tornado will fail to restart the "
-                      "server",
-        )),
     )
 
     def invoke(self, args):


Test patch:
diff --git a/bokeh/command/subcommands/tests/test_serve.py b/bokeh/command/subcommands/tests/test_serve.py
--- a/bokeh/command/subcommands/tests/test_serve.py
+++ b/bokeh/command/subcommands/tests/test_serve.py
@@ -112,7 +112,28 @@ def test_args():
         ('--args', dict(
             metavar='COMMAND-LINE-ARGS',
             nargs=argparse.REMAINDER,
-            help="Any command line arguments remaining are passed on to the application handler",
+            help="Command line arguments remaining to passed on to the application handler. "
+                 "NOTE: if this argument precedes DIRECTORY-OR-SCRIPT then some other argument, e.g "
+                 "--show, must be placed before the directory or script. ",
+        )),
+
+        ('--dev', dict(
+            metavar ='FILES-TO-WATCH',
+            action  ='store',
+            default = None,
+            type    = str,
+            nargs   = '*',
+            help    = "Enable live reloading during app development. "
+                      "By default it watches all *.py *.html *.css *.yaml files "
+                      "in the app directory tree. Additional files can be passed "
+                      "as arguments."
+                      "NOTE: if this argument precedes DIRECTORY-OR-SCRIPT then some other argument, e.g "
+                      "--show, must be placed before the directory or script. "
+                      "NOTE: This setting only works with a single app. "
+                      "It also restricts the number of processes to 1. "
+                      "NOTE FOR WINDOWS USERS : this option must be invoked using "
+                      "'python -m bokeh'. If not Tornado will fail to restart the "
+                      "server",
         )),
 
         ('--show', dict(
@@ -216,23 +237,6 @@ def test_args():
             default=20*1024*1024,
             type=int,
         )),
-
-        ('--dev', dict(
-            metavar ='FILES-TO-WATCH',
-            action  ='store',
-            default = None,
-            type    = str,
-            nargs   = '*',
-            help    = "Enable live reloading during app development. "
-                      "By default it watches all *.py *.html *.css *.yaml files "
-                      "in the app directory tree. Additional files can be passed "
-                      "as arguments. "
-                      "NOTE: This setting only works with a single app. "
-                      "It also restricts the number of processes to 1. "
-                      "NOTE FOR WINDOWS USERS : this option must be invoked using "
-                      "'python -m bokeh'. If not Tornado will fail to restart the "
-                      "server",
-        )),
     )