-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
3,042 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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,41 @@ | ||
# Remove the line below if you want to inherit .editorconfig settings from higher directories | ||
root = true | ||
|
||
#### Define style #### | ||
|
||
# All files | ||
[*] | ||
indent_style = space | ||
|
||
# C# Project, JS and CSS files | ||
[*.{csproj,js,ts,css,scss}] | ||
indent_size = 2 | ||
|
||
#### Suppress warnings #### | ||
|
||
# C# files | ||
[*.cs] | ||
|
||
# CA1056: Uri properties should not be strings | ||
dotnet_diagnostic.CA1056.severity = none | ||
|
||
# CA1303: Do not pass literals as localized parameters | ||
dotnet_diagnostic.CA1303.severity = none # Don't need translated exceptions | ||
|
||
# CA1308: Normalize strings to uppercase | ||
dotnet_diagnostic.CA1308.severity = none # Also to lower is required | ||
|
||
# CA1707: Identifiers should not contain underscores | ||
dotnet_diagnostic.CA1707.severity = none # I like underscores into constants name | ||
|
||
# CA1812: Avoid uninstantiated internal classes | ||
dotnet_diagnostic.CA1812.severity = none # Doing extensive use of Dependency Injection | ||
|
||
# CA1822: Mark members as static | ||
dotnet_diagnostic.CA1822.severity = none # Don't like static members | ||
|
||
# CA2007: Consider calling ConfigureAwait on the awaited task | ||
dotnet_diagnostic.CA2007.severity = none # .Net core doesn't require it | ||
|
||
# CA2234: Pass system uri objects instead of strings | ||
dotnet_diagnostic.CA2234.severity = none |
This file contains 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,150 @@ | ||
name: Publish stable release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
|
||
strategy: | ||
matrix: | ||
kind: [ | ||
'linux-x64', | ||
'linux-arm', | ||
'linux-arm64', | ||
|
||
'linux-selfcont-x64', | ||
'linux-selfcont-arm', | ||
'linux-selfcont-arm64', | ||
|
||
'macos-x64', | ||
'macos-arm64', | ||
|
||
'macos-selfcont-x64', | ||
'macos-selfcont-arm64', | ||
|
||
'windows-x86', | ||
'windows-x64', | ||
'windows-arm', | ||
'windows-arm64', | ||
|
||
'windows-selfcont-x86', | ||
'windows-selfcont-x64', | ||
'windows-selfcont-arm', | ||
'windows-selfcont-arm64'] | ||
include: | ||
- kind: linux-x64 | ||
os: ubuntu-latest | ||
target: linux-x64 | ||
frameworktype: --no-self-contained | ||
- kind: linux-arm | ||
os: ubuntu-latest | ||
target: linux-arm | ||
frameworktype: --no-self-contained | ||
- kind: linux-arm64 | ||
os: ubuntu-latest | ||
target: linux-arm64 | ||
frameworktype: --no-self-contained | ||
|
||
- kind: linux-selfcont-x64 | ||
os: ubuntu-latest | ||
target: linux-x64 | ||
frameworktype: --self-contained | ||
- kind: linux-selfcont-arm | ||
os: ubuntu-latest | ||
target: linux-arm | ||
frameworktype: --self-contained | ||
- kind: linux-selfcont-arm64 | ||
os: ubuntu-latest | ||
target: linux-arm64 | ||
frameworktype: --self-contained | ||
|
||
- kind: macos-x64 | ||
os: macOS-latest | ||
target: osx-x64 | ||
frameworktype: --no-self-contained | ||
- kind: macos-arm64 | ||
os: macOS-latest | ||
target: osx-arm64 | ||
frameworktype: --no-self-contained | ||
|
||
- kind: macos-selfcont-x64 | ||
os: macOS-latest | ||
target: osx-x64 | ||
frameworktype: --self-contained | ||
- kind: macos-selfcont-arm64 | ||
os: macOS-latest | ||
target: osx-arm64 | ||
frameworktype: --self-contained | ||
|
||
- kind: windows-x86 | ||
os: windows-latest | ||
target: win-x86 | ||
frameworktype: --no-self-contained | ||
- kind: windows-x64 | ||
os: windows-latest | ||
target: win-x64 | ||
frameworktype: --no-self-contained | ||
- kind: windows-arm | ||
os: windows-latest | ||
target: win-arm | ||
frameworktype: --no-self-contained | ||
- kind: windows-arm64 | ||
os: windows-latest | ||
target: win-arm64 | ||
frameworktype: --no-self-contained | ||
|
||
- kind: windows-selfcont-x86 | ||
os: windows-latest | ||
target: win-x86 | ||
frameworktype: --self-contained | ||
- kind: windows-selfcont-x64 | ||
os: windows-latest | ||
target: win-x64 | ||
frameworktype: --self-contained | ||
- kind: windows-selfcont-arm | ||
os: windows-latest | ||
target: win-arm | ||
frameworktype: --self-contained | ||
- kind: windows-selfcont-arm64 | ||
os: windows-latest | ||
target: win-arm64 | ||
frameworktype: --self-contained | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Build EthernaGatewayCli project | ||
shell: bash | ||
run: | | ||
tag=$(git describe --tags --abbrev=0) | ||
release_name="etherna-gateway-cli-$tag-${{ matrix.kind }}" | ||
# Build everything | ||
dotnet publish src/EthernaGatewayCli/EthernaGatewayCli.csproj --runtime "${{ matrix.target }}" "${{ matrix.frameworktype }}" -c Release -o "$release_name" | ||
# Pack files | ||
if [ "${{ matrix.kind }}" == windows* ]; then | ||
7z a -tzip "${release_name}.zip" "./${release_name}/*" | ||
else | ||
tar czvf "${release_name}.tar.gz" "$release_name" | ||
fi | ||
- name: Publish | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
etherna-gateway-cli-* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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 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,17 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue"> Copyright 2024-present Etherna SA | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License.</s:String> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Defund/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=etherna/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains 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 |
---|---|---|
|
@@ -4,10 +4,36 @@ | |
|
||
A CLI interface to the Etherna Gateway | ||
|
||
## Issue reports | ||
## Instructions | ||
Download and extract binaries from [release page](https://github.com/Etherna/etherna-gateway-cli/releases). | ||
|
||
Etherna Gateway CLI requires at least [.NET 8 Runtime](https://dotnet.microsoft.com/download/dotnet/8.0) and [ASP.NET Core 8 Runtime](https://dotnet.microsoft.com/download/dotnet/8.0) installed on local machine to run, or it needs the `selfcontained` version of package, that already contains framework dependencies. | ||
|
||
### How to use | ||
|
||
``` | ||
etherna | ||
A CLI interface to the Etherna Gateway | ||
Usage: etherna [OPTIONS] COMMAND | ||
Commands: | ||
download Download a resource from Swarm | ||
postage Manage postage batches | ||
resource Manage Swarm resources | ||
upload Upload a resource to Swarm | ||
Options: | ||
-k, --api-key string Api Key (optional) | ||
-i, --ignore-update Ignore new versions of EthernaGatewayCli | ||
Run 'etherna -h' or 'etherna --help' to print help. | ||
Run 'etherna COMMAND -h' or 'etherna COMMAND --help' for more information on a command. | ||
``` | ||
|
||
# Issue reports | ||
If you've discovered a bug, or have an idea for a new feature, please report it to our issue manager based on Jira https://etherna.atlassian.net/projects/EGC. | ||
|
||
## Questions? Problems? | ||
# Questions? Problems? | ||
|
||
For questions or problems please write an email to [[email protected]](mailto:[email protected]). |
This file contains 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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<!--To inherit the global NuGet package sources remove the <clear/> line below --> | ||
<clear /> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | ||
<add key="ethernaMyget" value="https://www.myget.org/F/etherna/api/v3/index.json" /> | ||
</packageSources> | ||
</configuration> |
This file contains 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,54 @@ | ||
// Copyright 2024-present Etherna SA | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Etherna.BeeNet.Clients.GatewayApi; | ||
using Etherna.GatewayCli.Models.Commands; | ||
using Etherna.GatewayCli.Services; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Etherna.GatewayCli.Commands.Etherna | ||
{ | ||
public class DownloadCommand : CommandBase<DownloadCommandOptions> | ||
{ | ||
// Fields. | ||
private readonly IAuthenticationService authService; | ||
private readonly IBeeGatewayClient beeGatewayClient; | ||
|
||
// Constructor. | ||
public DownloadCommand( | ||
IAuthenticationService authService, | ||
IBeeGatewayClient beeGatewayClient, | ||
IIoService ioService, | ||
IServiceProvider serviceProvider) | ||
: base(ioService, serviceProvider) | ||
{ | ||
this.authService = authService; | ||
this.beeGatewayClient = beeGatewayClient; | ||
} | ||
|
||
// Properties. | ||
public override string CommandArgsHelpString => "RESOURCE"; | ||
public override string Description => "Download a resource from Swarm"; | ||
|
||
// Protected methods. | ||
protected override async Task ExecuteAsync(string[] commandArgs) | ||
{ | ||
if (!Options.RunAnonymously) | ||
await authService.SignInAsync(); | ||
|
||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/EthernaGatewayCli/Commands/Etherna/DownloadCommandOptions.cs
This file contains 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,34 @@ | ||
// Copyright 2024-present Etherna SA | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Etherna.GatewayCli.Models.Commands; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Etherna.GatewayCli.Commands.Etherna | ||
{ | ||
public class DownloadCommandOptions : CommandOptionsBase | ||
{ | ||
// Definitions. | ||
public override IEnumerable<CommandOption> Definitions => new CommandOption[] | ||
{ | ||
new("-a", "--anon", "Download resource anonymously", _ => RunAnonymously = true), | ||
new("-o", "--output", "Resource output path. Default: current directory", args => OutputPath = args[0], new[] { typeof(string) }) | ||
}; | ||
|
||
// Options. | ||
public string OutputPath { get; private set; } = Environment.CurrentDirectory; | ||
public bool RunAnonymously { get; private set; } | ||
} | ||
} |
Oops, something went wrong.