-
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
111 changed files
with
381 additions
and
348 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 |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
</p> | ||
<h1 align="center">Dime.Scheduler CLI</h1> | ||
|
||
Connect with Dime.Scheduler through a .NET Tool. Check out the [📚 wiki](https://github.com/dime-scheduler/cli/wiki) for all the information on the CLI. | ||
Connect with Dime.Scheduler through the CLI. Check out the [📚 docs](https://docs.dimescheduler.com/develop/cli/intro) for all the information on the CLI. | ||
|
||
## Installation | ||
|
||
|
@@ -36,22 +36,18 @@ To clone and run this application, you'll need Visual Studio 16.7 or higher. The | |
The following example adds or updates a category in Dime.Scheduler: | ||
|
||
```cmd | ||
dimescheduler category | ||
-a | ||
-u https://mydimescheduler.io | ||
-c [email protected] | ||
-p mystrongpassword | ||
-n Service order status | ||
-h #32a852 | ||
dimescheduler category add -k "MYAPIKEY" -n 'Service order 123' -h #32a852 | ||
``` | ||
|
||
To specify an environment, add `--env` followed by either `Dev`, `Test`, or `Staging`. | ||
|
||
The entry point of the global tool is the `dimescheduler` command. | ||
|
||
<img src="assets/cmd.png" /> | ||
|
||
See the repo's [📚 wiki](https://github.com/dime-scheduler/cli/wiki) for a list of all commands and their parameters. | ||
See the [📚 docs](https://docs.dimescheduler.com/develop/cli/intro) for a list of all commands and their parameters. | ||
|
||
To see the parameters of a command, simply run the `dimescheduler` + `entity` + `--help` command and you'll get all the information you need: | ||
To see the parameters of a command, simply run the `dimescheduler` + `verb` + `entity` + `--help` command and you'll get all the information you need: | ||
|
||
<img src="assets/cmd-command.png" /> | ||
|
||
|
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
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
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
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
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
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
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,37 @@ | ||
using System; | ||
using Dime.Scheduler.CLI.Options; | ||
using Dime.Scheduler.Entities; | ||
using Task = System.Threading.Tasks.Task; | ||
|
||
namespace Dime.Scheduler.CLI.Commands | ||
{ | ||
public abstract class Command<TOptions, TImportable> | ||
where TOptions : BaseOptions, IImportConvertable | ||
where TImportable : class, IImportRequestable | ||
{ | ||
protected abstract string WriteIntro(TOptions options); | ||
|
||
public virtual async Task ProcessAsync(TOptions options) | ||
{ | ||
try | ||
{ | ||
Console.WriteLine(WriteIntro(options)); | ||
|
||
DimeSchedulerClient client = new(options.Key, options.Environment.GetDescription()); | ||
|
||
CrudAction action = options.Action.GetValueFromDescription<CrudAction>(); | ||
ImportSet result = await client.Import.ProcessAsync(options.ToImport(), action != CrudAction.Delete ? TransactionType.Append : TransactionType.Delete); | ||
|
||
Console.WriteLine(result.Success ? "Completed successfully" : "Request failed: " + result.Message); | ||
} | ||
catch (ArgumentException argException) | ||
{ | ||
Console.WriteLine("Action for this type was not recognized. Supported actions: add, update, delete"); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine(ex.Message); | ||
} | ||
} | ||
} | ||
} |
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
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 was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.