-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paradigm to update the scaffold files created by init
or initialize
: command for init --update
or similar
#65
Comments
@aaronsteers is there a generic |
There is not. And I would not want to have a generic But please don't read from the above that each individual dev could not provide something like What about adding a command group like
Then, for backwards compatibility and convenience, |
@aaronsteers I like the explicitness of command group proposal. |
Is this not just the same as something like
? Not sure Given that the I'm working on an implementation of this at the moment, so curious what your thoughts are. :)
from pathlib import Path
import typer
import {{ library_name }}.main as main
FILENAME_BLACKLIST = (
"__init__.py",
# for editable install only, otherwise covered by pyproject.toml exclude
"__pycache__",
)
app = typer.Typer(
name=Path(__file__).stem,
help="{{ extension_name }} plugin file operations.",
no_args_is_help=True,
)
@app.command()
def copy(
force: bool = typer.Option(False),
):
"""Copy the plugin files."""
main.ext.copy(
"{{ files_package_name }}",
force=force,
filename_blacklist=FILENAME_BLACKLIST,
) |
The We're retroactively suggesting a To me at least, While I would avoid So, on thinking more about the paradigm here, I kind of like this approach:
And for extensions which already support Wdyt? |
Two considerations here we'd want to solve for in a generic way if possible:
Decision 1. What logic to use when choosing whether to replace, ignore, or merge changes for files that already exist in their destinations.
Parity with files bundles would simply be the ability to specify an array of files to update. Those files specified would overwrite any existing files.
No smart merge logic exists as of today, but something like
copier
is interesting in how it attempts to apply a mergeable diff patch. (Probably more scope that is feasible in a first iteration.)Decision 2: What to call the command or subcommand used to update the files or project scaffold
A starting proposal would be to add a flag after the
init
orinitialize
command which is already being used to install the files the first time. I think I like--update
best personally, but I'll list a few ideas / thought experiments below.Related:
The text was updated successfully, but these errors were encountered: