Skip to content

feat(sails-cli): Similar behavior to cargo new ... if executed within a workspace #504

@gshep

Description

@gshep

Problem to Solve

If one runs cargo new ... within a workspace cargo detects that and modifies the workspace's Cargo.toml accordingly. For example:

gear-tech/gear/examples$ cargo new new-example --lib
     Created library `new-example` package
gear-tech/gear/examples$ cd ..
gear-tech/gear$ git st
On branch branch
Your branch is ahead of 'origin/breanch' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   Cargo.toml

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        examples/new-example/

no changes added to commit (use "git add" and/or "git commit -a")

$ git diff
diff --git a/Cargo.toml b/Cargo.toml
index 965527c51..f8edd3923 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -99,7 +99,7 @@ members = [
     "runtime/*",
     "utils/*",
     "utils/runtime-fuzzer/fuzz"
-]
+, "examples/new-example"]
 
 [workspace.dependencies]
 anyhow = "1.0.81"

However for cargo-sails new-program ... it looks like:

$ cargo-sails new-program new-sails-example 
gear-tech/gear/examples$ cd ..
gear-tech/gear$ git st
On branch branch
Your branch is ahead of 'origin/branch' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        examples/new-sails-example/

nothing added to commit but untracked files present (use "git add" to track)

It would be nice to repeat after cargo new ... and define all new sails project (workspace) members in the workspace's Cargo.toml.

Possible Solution

to research

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions