diff --git a/sekai-cli/gradle.properties b/sekai-cli/gradle.properties index a927e2b..911432c 100644 --- a/sekai-cli/gradle.properties +++ b/sekai-cli/gradle.properties @@ -1,4 +1,4 @@ ## Project Configurations # Proj Metadata -moduleVersion = 0.5 +moduleVersion = 0.5.1 diff --git a/sekai-cli/src/main/java/cc/sukazyo/sekai_cli/client/AddScore.java b/sekai-cli/src/main/java/cc/sukazyo/sekai_cli/client/AddScore.java index 10ca384..ca90d44 100644 --- a/sekai-cli/src/main/java/cc/sukazyo/sekai_cli/client/AddScore.java +++ b/sekai-cli/src/main/java/cc/sukazyo/sekai_cli/client/AddScore.java @@ -2,17 +2,45 @@ package cc.sukazyo.sekai_cli.client; import cc.sukazyo.sekai_scores.ScoreBase; +import java.util.ArrayList; import java.util.InputMismatchException; +import java.util.List; import java.util.Scanner; import static cc.sukazyo.sekai_cli.Log._debug; +import static cc.sukazyo.sekai_cli.Log._user; public class AddScore { public static void main (String[] args) { + // process params available in add command + Long user_sekai_id = null; + final List $args = new ArrayList<>(List.of(args)); + int $arg_i; + if (($arg_i = $args.indexOf("--user")) != -1) { + // subcommand --user to use a user instead of the user.id defined in Config + $args.remove($arg_i); + try { + user_sekai_id = Long.parseLong($args.get($arg_i)); + $args.remove($arg_i); + _debug("add: defined user id to use by param: " + user_sekai_id); + } + catch (IndexOutOfBoundsException e) { + _user("add: param --user need a number as user_id.\n use `--user ` to make it work properly."); + _debug(e); + } catch (NumberFormatException e) { + _user("add: param --user need a user_id which type should be a number:\n " + e.getMessage()); + _debug(e); + } + } + args = $args.toArray(String[]::new); + try { + ///-- + // scores input + final int[] scores = new int[9]; if (args.length == 0) { @@ -38,6 +66,10 @@ public class AddScore { scores[6], scores[5], scores[7], scores[8] ); + ///-- + // echo and making confirm + + System.out.println(PrintScore.printTableScoreBase(scoreBase)); } catch (ArrayIndexOutOfBoundsException | NumberFormatException e) {