Skip to content
  • Petrik's avatar
    977bc539
    Use indentation for dividing sections in USAGE files · 977bc539
    Petrik authored
    Thor, the generator USAGE files and some command USAGE files use
    identation to divide the USAGE files into separate sections.
    Indentation is also used to describe the options that can be passed
    to the commands.
    
    For consistency we should use the same formatting for all commands.
    As Thor and most USAGE files already use identation it's a smaller
    change to use identation for all commands.
    
    For the examples extra identation is used. This makes them stand out
    more allows removing the backticks which make it easier to copy the code
    examples.
    
    __Before (example for runner)__
    
    ```console
    bin/rails runner --help
    Commands:
      bin/rails runner [<'Some.ruby(code)'> | <filename.rb> | -]  # Run Ruby code in the context of your application
      bin/rails runner:help [COMMAND]                             # Describe available commands or one specific command
    
    Options:
      -e, [--environment=ENVIRONMENT]  # The environment to run `runner` in (e.g. test / development / production).
    
    Examples:
    
    Run `puts Rails.env` after loading the app:
    
      bin/rails runner 'puts Rails.env'
    
    Run the Ruby file located at `path/to/filename.rb` after loading the app:
    
      bin/rails runner path/to/filename.rb
    
    Run the Ruby script read from stdin after loading the app:
    
      bin/rails runner -
    
    You can also use the runner command as a shebang line for your executables:
    
      #!/usr/bin/env /path/to/weblog/bin/rails runner
    
      Product.all.each { |p| p.price *= 2 ; p.save! }
    ```
    
    __After__
    
    ```console
    bin/rails runner --help
    Usage:
      bin/rails runner [<'Some.ruby(code)'> | <filename.rb> | -]
    
    Options:
      -e, [--environment=ENVIRONMENT]  # The environment to run `runner` in (e.g. test / development / production).
    
    Run Ruby code in the context of your application
    
    Description:
        The Rails `runner` allows running Ruby code in the context of your application.
    
    Examples:
        Run `puts Rails.env` after loading the app:
    
            bin/rails runner 'puts Rails.env'
    
        Run the Ruby file located at `path/to/filename.rb` after loading the app:
    
            bin/rails runner path/to/filename.rb
    
        Run the Ruby script read from stdin after loading the app:
    
            bin/rails runner -
    
        You can also use the runner command as a shebang line for your executables:
    
            #!/usr/bin/env /path/to/weblog/bin/rails runner
            Product.all.each { |p| p.price *= 2 ; p.save! }
    ```
    977bc539
    Use indentation for dividing sections in USAGE files
    Petrik authored
    Thor, the generator USAGE files and some command USAGE files use
    identation to divide the USAGE files into separate sections.
    Indentation is also used to describe the options that can be passed
    to the commands.
    
    For consistency we should use the same formatting for all commands.
    As Thor and most USAGE files already use identation it's a smaller
    change to use identation for all commands.
    
    For the examples extra identation is used. This makes them stand out
    more allows removing the backticks which make it easier to copy the code
    examples.
    
    __Before (example for runner)__
    
    ```console
    bin/rails runner --help
    Commands:
      bin/rails runner [<'Some.ruby(code)'> | <filename.rb> | -]  # Run Ruby code in the context of your application
      bin/rails runner:help [COMMAND]                             # Describe available commands or one specific command
    
    Options:
      -e, [--environment=ENVIRONMENT]  # The environment to run `runner` in (e.g. test / development / production).
    
    Examples:
    
    Run `puts Rails.env` after loading the app:
    
      bin/rails runner 'puts Rails.env'
    
    Run the Ruby file located at `path/to/filename.rb` after loading the app:
    
      bin/rails runner path/to/filename.rb
    
    Run the Ruby script read from stdin after loading the app:
    
      bin/rails runner -
    
    You can also use the runner command as a shebang line for your executables:
    
      #!/usr/bin/env /path/to/weblog/bin/rails runner
    
      Product.all.each { |p| p.price *= 2 ; p.save! }
    ```
    
    __After__
    
    ```console
    bin/rails runner --help
    Usage:
      bin/rails runner [<'Some.ruby(code)'> | <filename.rb> | -]
    
    Options:
      -e, [--environment=ENVIRONMENT]  # The environment to run `runner` in (e.g. test / development / production).
    
    Run Ruby code in the context of your application
    
    Description:
        The Rails `runner` allows running Ruby code in the context of your application.
    
    Examples:
        Run `puts Rails.env` after loading the app:
    
            bin/rails runner 'puts Rails.env'
    
        Run the Ruby file located at `path/to/filename.rb` after loading the app:
    
            bin/rails runner path/to/filename.rb
    
        Run the Ruby script read from stdin after loading the app:
    
            bin/rails runner -
    
        You can also use the runner command as a shebang line for your executables:
    
            #!/usr/bin/env /path/to/weblog/bin/rails runner
            Product.all.each { |p| p.price *= 2 ; p.save! }
    ```
Loading