Skip to content

Consider passing raw command line args to initialize.sh for early processing/parsing.  #685

Closed

Description

@surgiie

Description

Some scripts or CLIs may need to parse command-line arguments/options during early initialization (in initialize.sh). Currently, since the initialize function is called with no arguments, things like $# is 0 and $@ is empty at that point. Additionally, $args hasn't been parsed yet during early initialization, making the raw arguments inaccessible.

Could we pass the arguments to initialize to enable early parsing? For example:

command_line_args=("$@")
initialize "${command_line_args[@]}"  # pass args for early access if needed
run "${command_line_args[@]}"

Is there any reason not to do this?

Activity

  1. changed the title [-]Consider passing command line args to initialize.sh[/-] [+]Consider passing raw command line args to initialize.sh for early processing/parsing. [/+] on Nov 19, 2025
  2. DannyBen commented on Nov 19, 2025

    @DannyBen
    Member

    This feature is already available. If we were passing it to initialize, then you would have a copy of that array, and would not have been able to modify it.

    It is done like this on purpose, so you can both read and modify it, by simply changing the command_line_args as you see fit.

    More info:

    Does this cover your use case?

  3. surgiie commented on Nov 19, 2025

    @surgiie
    Author

    @DannyBen Yes sorry i guess i failed to find these docs. 😓

  4. DannyBen commented on Nov 19, 2025

    @DannyBen
    Member

    @DannyBen Yes sorry i guess i failed to find these docs. 😓

    No worries - if you failed to find the docs, it is also a bug :)
    If you think this should be mentioned somewhere else as well, let me know.

  5. added
    questionRequest for help or general question
    and removed
    enhancementNew feature or request
    on Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionRequest for help or general question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions