-
Notifications
You must be signed in to change notification settings - Fork 1
feature #45/ dynamic argument flags #46
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
44ce9a4
feature #45/ dynamic argument flags
davidramnero e388108
wip working dynamic args
davidramnero ca38df9
working
davidramnero 9bd3b7c
updated readme
davidramnero e811c23
small readme update
davidramnero d1ebe82
removed specifying language to run script with
davidramnero 1b472d2
made script command parsing a bit more general + updated readme
davidramnero 0b220b1
removed console log
davidramnero bb99ade
reworked to make command running more generic
davidramnero d5e0430
removed reference to removed function
davidramnero 61b8745
updated readme to be a bit clearer
davidramnero 5e95845
clarified some comments
davidramnero d40f020
removed whitespace
davidramnero c86e071
rerun script for every analysis
davidramnero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import * as path from "path"; | ||
| import * as os from "os"; | ||
| import * as vscode from 'vscode'; | ||
|
|
||
| export function resolvePath(argPath: string): string { | ||
| const folders = vscode.workspace.workspaceFolders; | ||
| const workspaceRoot = folders && folders.length > 0 | ||
| ? folders[0].uri.fsPath | ||
| : process.cwd(); | ||
|
|
||
| // Expand ${workspaceFolder} | ||
| if (argPath.includes("${workspaceFolder}")) { | ||
| argPath = argPath.replace("${workspaceFolder}", workspaceRoot); | ||
| } | ||
|
|
||
| // Expand tilde (~) to home directory | ||
| if (argPath.startsWith("~")) { | ||
| argPath = path.join(os.homedir(), argPath.slice(1)); | ||
| } | ||
|
|
||
| // Expand ./ or ../ relative paths (relative to workspace root if available) | ||
| if (argPath.startsWith("./") || argPath.startsWith("../")) { | ||
| argPath = path.resolve(workspaceRoot, argPath); | ||
| } | ||
|
|
||
| // If still not absolute, treat it as relative to workspace root | ||
| if (!path.isAbsolute(argPath)) { | ||
| argPath = path.join(workspaceRoot, argPath); | ||
| } | ||
| return argPath; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { exec } from "child_process"; | ||
| import { resolvePath } from './path'; | ||
| import util from 'util'; | ||
|
|
||
| const execAsync = util.promisify(exec); | ||
|
|
||
| async function runCommand(command : string) { | ||
| try { | ||
| const { stdout, stderr } = await execAsync(command, { | ||
| cwd: resolvePath('${workspaceFolder}'), | ||
| }); | ||
|
|
||
| if (stderr) { | ||
| throw new Error(stderr); | ||
| } | ||
| return stdout; | ||
| } catch (error) { | ||
| throw error; | ||
| } | ||
| } | ||
|
|
||
| export { runCommand }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.