securewithtrace 0.21.3 → 0.21.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28507,15 +28507,26 @@ async function fetchCloneToken(repoUrl) {
|
|
|
28507
28507
|
}
|
|
28508
28508
|
}
|
|
28509
28509
|
function createCloneCommand() {
|
|
28510
|
-
return new Command("clone").description("Clone a repository").argument("<repository>", "Repository URL or owner/repo shorthand").argument("[directory]", "Directory to clone into").option("--branch <branch>", "Branch to clone").option("--depth <depth>", "Shallow clone depth", parseCloneDepth).addHelpText(
|
|
28510
|
+
return new Command("clone").description("Clone a repository").argument("<repository>", "Repository URL or owner/repo shorthand").argument("[directory]", "Directory to clone into").option("--branch <branch>", "Branch to clone").option("--depth <depth>", "Shallow clone depth", parseCloneDepth).option("-w, --web", "Open the repository URL in a browser instead of cloning").addHelpText(
|
|
28511
28511
|
"after",
|
|
28512
28512
|
`
|
|
28513
28513
|
Examples:
|
|
28514
28514
|
tracecli repo clone securewithtrace/trace
|
|
28515
28515
|
tracecli repo clone securewithtrace/trace trace-src
|
|
28516
|
-
tracecli repo clone https://github.com/owner/repo --branch main --depth 1
|
|
28516
|
+
tracecli repo clone https://github.com/owner/repo --branch main --depth 1
|
|
28517
|
+
tracecli repo clone securewithtrace/trace --web`
|
|
28517
28518
|
).action(
|
|
28518
28519
|
async (repository, directory, options) => {
|
|
28520
|
+
if (options.web) {
|
|
28521
|
+
const resolved = resolveRepoUrl(repository);
|
|
28522
|
+
const sshMatch = resolved.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
28523
|
+
const webUrl = sshMatch?.[1] && sshMatch?.[2] ? `https://${sshMatch[1]}/${sshMatch[2]}` : resolved;
|
|
28524
|
+
const opened = await openBrowser(webUrl);
|
|
28525
|
+
if (!opened) {
|
|
28526
|
+
console.log(`Open in browser: ${webUrl}`);
|
|
28527
|
+
}
|
|
28528
|
+
return;
|
|
28529
|
+
}
|
|
28519
28530
|
const cloneUrl = resolveRepoUrl(repository);
|
|
28520
28531
|
const targetDir = directory ?? extractRepoName(repository);
|
|
28521
28532
|
let installationToken = null;
|