Skip to content

Commit c33e9d4

Browse files
authored
CLI installation using Chocolatey for Windows (#170)
* Add chocolatey nuspec * Add instructions * Remove scaffold files * Remove unnecessary scripts * Update nuspec * Correct nuspec based on review feedback
1 parent 3c5a1f1 commit c33e9d4

File tree

4 files changed

+170
-100
lines changed

4 files changed

+170
-100
lines changed

cli/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
!src/proto/**/debug
1+
!src/proto/**/debug
2+
*.nupkg

cli/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@ brew tap trinsic-id/trinsic-cli
99
brew install trinsic-cli
1010
```
1111

12-
### Using Cargo
12+
### Install from source using Cargo
1313

1414
Requires [Rustup](https://www.rust-lang.org/tools/install) nightly toolchain
1515

1616
```bash
1717
cargo +nightly install --git https://github.com/trinsic-id/sdk trinsic
1818
```
1919

20+
### Using Chocolatey for Windows
21+
22+
```
23+
choco install trinsic-cli
24+
```
25+
2026
## Usage
2127

2228
```
Lines changed: 98 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,98 @@
1-
#[doc = r" Generated client implementations."]
2-
pub mod debugging_client {
3-
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
4-
use tonic::codegen::*;
5-
#[derive(Debug, Clone)]
6-
pub struct DebuggingClient<T> {
7-
inner: tonic::client::Grpc<T>,
8-
}
9-
impl DebuggingClient<tonic::transport::Channel> {
10-
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
11-
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
12-
where
13-
D: std::convert::TryInto<tonic::transport::Endpoint>,
14-
D::Error: Into<StdError>,
15-
{
16-
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
17-
Ok(Self::new(conn))
18-
}
19-
}
20-
impl<T> DebuggingClient<T>
21-
where
22-
T: tonic::client::GrpcService<tonic::body::BoxBody>,
23-
T::ResponseBody: Body + Send + 'static,
24-
T::Error: Into<StdError>,
25-
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
26-
{
27-
pub fn new(inner: T) -> Self {
28-
let inner = tonic::client::Grpc::new(inner);
29-
Self { inner }
30-
}
31-
pub fn with_interceptor<F>(
32-
inner: T,
33-
interceptor: F,
34-
) -> DebuggingClient<InterceptedService<T, F>>
35-
where
36-
F: tonic::service::Interceptor,
37-
T: tonic::codegen::Service<
38-
http::Request<tonic::body::BoxBody>,
39-
Response = http::Response<
40-
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
41-
>,
42-
>,
43-
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
44-
Into<StdError> + Send + Sync,
45-
{
46-
DebuggingClient::new(InterceptedService::new(inner, interceptor))
47-
}
48-
#[doc = r" Compress requests with `gzip`."]
49-
#[doc = r""]
50-
#[doc = r" This requires the server to support it otherwise it might respond with an"]
51-
#[doc = r" error."]
52-
pub fn send_gzip(mut self) -> Self {
53-
self.inner = self.inner.send_gzip();
54-
self
55-
}
56-
#[doc = r" Enable decompressing responses with `gzip`."]
57-
pub fn accept_gzip(mut self) -> Self {
58-
self.inner = self.inner.accept_gzip();
59-
self
60-
}
61-
pub async fn call_empty(
62-
&mut self,
63-
request: impl tonic::IntoRequest<super::super::super::super::google::protobuf::Empty>,
64-
) -> Result<
65-
tonic::Response<super::super::super::super::google::protobuf::Empty>,
66-
tonic::Status,
67-
> {
68-
self.inner.ready().await.map_err(|e| {
69-
tonic::Status::new(
70-
tonic::Code::Unknown,
71-
format!("Service was not ready: {}", e.into()),
72-
)
73-
})?;
74-
let codec = tonic::codec::ProstCodec::default();
75-
let path =
76-
http::uri::PathAndQuery::from_static("/services.debug.v1.Debugging/CallEmpty");
77-
self.inner.unary(request.into_request(), path, codec).await
78-
}
79-
pub async fn call_empty_auth(
80-
&mut self,
81-
request: impl tonic::IntoRequest<super::super::super::super::google::protobuf::Empty>,
82-
) -> Result<
83-
tonic::Response<super::super::super::super::google::protobuf::Empty>,
84-
tonic::Status,
85-
> {
86-
self.inner.ready().await.map_err(|e| {
87-
tonic::Status::new(
88-
tonic::Code::Unknown,
89-
format!("Service was not ready: {}", e.into()),
90-
)
91-
})?;
92-
let codec = tonic::codec::ProstCodec::default();
93-
let path =
94-
http::uri::PathAndQuery::from_static("/services.debug.v1.Debugging/CallEmptyAuth");
95-
self.inner.unary(request.into_request(), path, codec).await
96-
}
97-
}
98-
}
1+
#[doc = r" Generated client implementations."]
2+
pub mod debugging_client {
3+
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
4+
use tonic::codegen::*;
5+
#[derive(Debug, Clone)]
6+
pub struct DebuggingClient<T> {
7+
inner: tonic::client::Grpc<T>,
8+
}
9+
impl DebuggingClient<tonic::transport::Channel> {
10+
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
11+
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
12+
where
13+
D: std::convert::TryInto<tonic::transport::Endpoint>,
14+
D::Error: Into<StdError>,
15+
{
16+
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
17+
Ok(Self::new(conn))
18+
}
19+
}
20+
impl<T> DebuggingClient<T>
21+
where
22+
T: tonic::client::GrpcService<tonic::body::BoxBody>,
23+
T::ResponseBody: Body + Send + 'static,
24+
T::Error: Into<StdError>,
25+
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
26+
{
27+
pub fn new(inner: T) -> Self {
28+
let inner = tonic::client::Grpc::new(inner);
29+
Self { inner }
30+
}
31+
pub fn with_interceptor<F>(
32+
inner: T,
33+
interceptor: F,
34+
) -> DebuggingClient<InterceptedService<T, F>>
35+
where
36+
F: tonic::service::Interceptor,
37+
T: tonic::codegen::Service<
38+
http::Request<tonic::body::BoxBody>,
39+
Response = http::Response<
40+
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
41+
>,
42+
>,
43+
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
44+
Into<StdError> + Send + Sync,
45+
{
46+
DebuggingClient::new(InterceptedService::new(inner, interceptor))
47+
}
48+
#[doc = r" Compress requests with `gzip`."]
49+
#[doc = r""]
50+
#[doc = r" This requires the server to support it otherwise it might respond with an"]
51+
#[doc = r" error."]
52+
pub fn send_gzip(mut self) -> Self {
53+
self.inner = self.inner.send_gzip();
54+
self
55+
}
56+
#[doc = r" Enable decompressing responses with `gzip`."]
57+
pub fn accept_gzip(mut self) -> Self {
58+
self.inner = self.inner.accept_gzip();
59+
self
60+
}
61+
pub async fn call_empty(
62+
&mut self,
63+
request: impl tonic::IntoRequest<super::super::super::super::google::protobuf::Empty>,
64+
) -> Result<
65+
tonic::Response<super::super::super::super::google::protobuf::Empty>,
66+
tonic::Status,
67+
> {
68+
self.inner.ready().await.map_err(|e| {
69+
tonic::Status::new(
70+
tonic::Code::Unknown,
71+
format!("Service was not ready: {}", e.into()),
72+
)
73+
})?;
74+
let codec = tonic::codec::ProstCodec::default();
75+
let path =
76+
http::uri::PathAndQuery::from_static("/services.debug.v1.Debugging/CallEmpty");
77+
self.inner.unary(request.into_request(), path, codec).await
78+
}
79+
pub async fn call_empty_auth(
80+
&mut self,
81+
request: impl tonic::IntoRequest<super::super::super::super::google::protobuf::Empty>,
82+
) -> Result<
83+
tonic::Response<super::super::super::super::google::protobuf::Empty>,
84+
tonic::Status,
85+
> {
86+
self.inner.ready().await.map_err(|e| {
87+
tonic::Status::new(
88+
tonic::Code::Unknown,
89+
format!("Service was not ready: {}", e.into()),
90+
)
91+
})?;
92+
let codec = tonic::codec::ProstCodec::default();
93+
let path =
94+
http::uri::PathAndQuery::from_static("/services.debug.v1.Debugging/CallEmptyAuth");
95+
self.inner.unary(request.into_request(), path, codec).await
96+
}
97+
}
98+
}

cli/trinsic-cli.nuspec

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
3+
<metadata>
4+
<!-- == PACKAGE SPECIFIC SECTION == -->
5+
<!-- This section is about this package, although id and version have ties back to the software -->
6+
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template -->
7+
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible. -->
8+
<id>trinsic-cli</id>
9+
<!-- version should MATCH as closely as possible with the underlying software -->
10+
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
11+
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
12+
<version>1.0.0</version>
13+
<packageSourceUrl>https://github.com/trinsic-id/sdk/tree/main/cli/choco</packageSourceUrl>
14+
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
15+
<owners>Tomislav Markovski</owners>
16+
<!-- ============================== -->
17+
18+
<!-- == SOFTWARE SPECIFIC SECTION == -->
19+
<!-- This section is about the software itself -->
20+
<title>trinsic-cli (Install)</title>
21+
<authors>Tomislav Markovski</authors>
22+
<!-- projectUrl is required for the community feed -->
23+
<projectUrl>https://github.com/trinsic-id/sdk</projectUrl>
24+
<!-- There are a number of CDN Services that can be used for hosting the Icon for a package. More information can be found here: https://docs.chocolatey.org/en-us/create/create-packages#package-icon-guidelines -->
25+
<!-- Here is an example using Githack -->
26+
<!--<iconUrl>http://rawcdn.githack.com/__REPLACE_YOUR_REPO__/master/icons/trinsic-cli.png</iconUrl>-->
27+
<!-- <copyright>Year Software Vendor</copyright> -->
28+
<!-- If there is a license Url available, it is required for the community feed -->
29+
<licenseUrl>https://github.com/trinsic-id/sdk/tree/main/LICENSE</licenseUrl>
30+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
31+
<projectSourceUrl>https://github.com/trinsic-id/sdk/tree/main/cli</projectSourceUrl>
32+
<docsUrl>https://docs-v2.trinsic.id</docsUrl>
33+
<!--<mailingListUrl></mailingListUrl>-->
34+
<bugTrackerUrl>https://github.com/trinsic-id/sdk/issues</bugTrackerUrl>
35+
<tags>trinsic-cli</tags>
36+
<summary>Trinsic CLI</summary>
37+
<description>Command-line interface for access to Trinsic Ecosystems Cloud</description>
38+
<releaseNotes>Initial release of Trinsic CLI featuring Universal Wallet, Verifiable Credentials, Trust Registry.</releaseNotes>
39+
<!-- =============================== -->
40+
41+
<!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files -->
42+
<!--<dependencies>
43+
<dependency id="" version="__MINIMUM_VERSION__" />
44+
<dependency id="" version="[__EXACT_VERSION__]" />
45+
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_INCLUSIVE]" />
46+
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_EXCLUSIVE)" />
47+
<dependency id="" />
48+
<dependency id="chocolatey-core.extension" version="1.1.0" />
49+
</dependencies>-->
50+
<!-- chocolatey-core.extension - https://community.chocolatey.org/packages/chocolatey-core.extension
51+
- You want to use Get-UninstallRegistryKey on less than 0.9.10 (in chocolateyUninstall.ps1)
52+
- You want to use Get-PackageParameters and on less than 0.11.0
53+
- You want to take advantage of other functions in the core community maintainer's team extension package
54+
-->
55+
56+
<!--<provides>NOT YET IMPLEMENTED</provides>-->
57+
<!--<conflicts>NOT YET IMPLEMENTED</conflicts>-->
58+
<!--<replaces>NOT YET IMPLEMENTED</replaces>-->
59+
</metadata>
60+
<files>
61+
<file src="target\release\trinsic.exe" target="bin" />
62+
</files>
63+
</package>

0 commit comments

Comments
 (0)