Skip to content

Commit

Permalink
Refactor, create config directory
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarcederberg committed Jul 25, 2021
1 parent cc1e118 commit 657b2c8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 41 deletions.
19 changes: 19 additions & 0 deletions Class/Options.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using CommandLine;

namespace tarot{
[Verb("get", HelpText = "Retrieve cards from the deck.")]
public class GetOptions{
[Value(0, MetaName = "amount", MetaValue = "int", Default = 1, HelpText = "Amount of cards to retrieve.")]
public uint Amount{get; set;}
}

[Verb("shuffle", HelpText = "Shuffle the deck")]
public class ShuffleOptions{
[Value(0, MetaName = "type", MetaValue = "string", Default = "riffle", HelpText = "What shuffle to perform.")]
public string Type{get; set;}
[Value(1, MetaName = "amount", MetaValue = "int", Default = 1, HelpText = "Number of shuffles to perform.")]
public int Amount{get; set;}
[Option('q',"quiet", HelpText = "Suppress stdout.")]
public bool Quiet{get; set;}
}
}
21 changes: 5 additions & 16 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
using System;
using System.IO;
using CommandLine;

namespace tarot{
class Program{
[Verb("get", HelpText = "Retrieve cards from the deck.")]
public class GetOptions{
[Value(0, MetaName = "amount", MetaValue = "int", Default = 1, HelpText = "Amount of cards to retrieve.")]
public uint Amount{get; set;}
}

[Verb("shuffle", HelpText = "Shuffle the deck")]
public class ShuffleOptions{
[Value(0, MetaName = "type", MetaValue = "string", Default = "riffle", HelpText = "What shuffle to perform.")]
public string Type{get; set;}
[Value(1, MetaName = "amount", MetaValue = "int", Default = 1, HelpText = "Number of shuffles to perform.")]
public int Amount{get; set;}
[Option('q',"quiet", HelpText = "Suppress stdout.")]
public bool Quiet{get; set;}
}

static int Main(string[] args){
string userPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
string configPath = Path.Combine(userPath,@".config/tarot/");
Directory.CreateDirectory(configPath);

Type[] types = {typeof(ShuffleOptions), typeof(GetOptions)};

Deck deck = new Deck();
Expand Down
1 change: 1 addition & 0 deletions tarot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Company>oscarcederberg</Company>
</PropertyGroup>

<ItemGroup>
Expand Down
25 changes: 0 additions & 25 deletions tarot.sln

This file was deleted.

0 comments on commit 657b2c8

Please sign in to comment.