Skip to content
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

feat: add version output #148

Merged
merged 3 commits into from
Jun 7, 2024

Conversation

chenrui333
Copy link
Contributor

@chenrui333 chenrui333 commented May 24, 2024

$ swift build -c release --product whisperkit-cli --disable-sandbox
...

$ .build/arm64-apple-macosx/release/whisperkit-cli version
WhisperKitCLI version 0.7.0

fixes #147

cc @ZachNagengast

@chenrui333 chenrui333 force-pushed the add-version-command branch from 4d30b85 to 4caa780 Compare May 24, 2024 23:19
Copy link
Contributor

@ZachNagengast ZachNagengast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help with the homebrew update. This is a great idea! Do you think there's a way to do this based on the latest git value or something automated? We're calling cli commands here

extension Process {
static func stringFromTerminal(command: String) -> String {
let task = Process()
let pipe = Pipe()
task.standardOutput = pipe
task.launchPath = "/bin/bash"
task.arguments = ["-c", "sysctl -n " + command]
task.launch()
return String(bytes: pipe.fileHandleForReading.availableData, encoding: .utf8) ?? ""
}
static let processor = stringFromTerminal(command: "machdep.cpu.brand_string")
static let cores = stringFromTerminal(command: "machdep.cpu.core_count")
static let threads = stringFromTerminal(command: "machdep.cpu.thread_count")
static let vendor = stringFromTerminal(command: "machdep.cpu.vendor")
static let family = stringFromTerminal(command: "machdep.cpu.family")
}

which seems to work well, perhaps current version could be a computed property based on git describe --tags

Copy link
Contributor

@ZachNagengast ZachNagengast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chenrui333 Updated this PR with the built-in version param on CommandConfiguration. I've updated the formula argmaxincbot/homebrew-core#1 such that it will use the tag from the URL to replace this placeholder, which will then be available in the build that homebrew makes. This way the version will always be up to date and self contained in the homebrew formula, lmk what you think

@ZachNagengast
Copy link
Contributor

Tests are passing, will merge if there's no objections in a bit.

@chenrui333
Copy link
Contributor Author

yeah, if we can make sure version is good as part of the release script, all good to me

@ZachNagengast ZachNagengast merged commit fc6bfeb into argmaxinc:main Jun 7, 2024
9 checks passed
iandundas pushed a commit to iandundas/WhisperKit that referenced this pull request Jun 21, 2024
* feat: add version output

Signed-off-by: Rui Chen <[email protected]>

* Add placeholder string for version via swift-argument-parser config

---------

Signed-off-by: Rui Chen <[email protected]>
Co-authored-by: ZachNagengast <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add version support
2 participants