Snapcraft export-login without prompt username and password

I’d like to export login credential every 3 months , but via CICD pipeline.

currently when run snapcraft export-login exported, it will prompt for username and password, then will generate the credentials file called exported.

later I can easily save this file exported as CICD pipeline secrets. In pipeline tasks, I can easily login with it.

snapcraft login --with exported

So I need parameters in snap-craft export-login with extra options, such as:

--username xxxx
--password xxxx

The command looks like this

# ${username} and ${password} are saved as secure environment variables in CICD pipeline

$ snapcraft export-login --username ${username} --password ${password}  exported

So I can run the command without prompt. Any suggestions to implement it?

so the code ( _store.py ) hard code to only get username/password from prompt

    email = ""
    password = ""

    if not config_fd:
        echo.wrapped("Enter your Ubuntu One e-mail address and password.")
        echo.wrapped(
            "If you do not have an Ubuntu One account, you can create one "
            "at https://snapcraft.io/account"
        )
        email = echo.prompt("Email")
        if os.getenv("SNAPCRAFT_TEST_INPUT"):
            # Integration tests do not work well with hidden input.
            echo.warning("Password will be visible.")
            hide_input = False
        else:
            hide_input = True
        password = echo.prompt("Password", hide_input=hide_input)

But why?

ref: https://github.com/snapcore/snapcraft/blob/main/snapcraft/_store.py

_store is part of the cli, it makes sense it would only support what we expose on the CLI.

but if we’d like to run the command with automation way, it becomes a block.

there should be a flexable way to allow clients to login via command line directly. such as

snapcraft export-login --username xxxx --password xxxx exported