]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/UpdateProfileCommand.java
Only attempt to delete profile avatar if it exists
[signal-cli] / src / main / java / org / asamk / signal / commands / UpdateProfileCommand.java
index c2ff2e5e0e624d920097a1d0f4b65b089fdc18df..5455f523ab58ac99a16b0c0d04734feea5876df3 100644 (file)
@@ -15,18 +15,22 @@ public class UpdateProfileCommand implements LocalCommand {
 
     @Override
     public void attachToSubparser(final Subparser subparser) {
+        subparser.addArgument("--name").help("New profile name");
+        subparser.addArgument("--about").help("New profile about text");
+        subparser.addArgument("--about-emoji").help("New profile about emoji");
+
         final MutuallyExclusiveGroup avatarOptions = subparser.addMutuallyExclusiveGroup();
         avatarOptions.addArgument("--avatar").help("Path to new profile avatar");
         avatarOptions.addArgument("--remove-avatar").action(Arguments.storeTrue());
 
-        subparser.addArgument("--name").required(true).help("New profile name");
-
-        subparser.help("Set a name and avatar image for the user profile");
+        subparser.help("Set a name, about and avatar image for the user profile");
     }
 
     @Override
     public int handleCommand(final Namespace ns, final Manager m) {
         String name = ns.getString("name");
+        String about = ns.getString("about");
+        String aboutEmoji = ns.getString("about_emoji");
         String avatarPath = ns.getString("avatar");
         boolean removeAvatar = ns.getBoolean("remove_avatar");
 
@@ -34,9 +38,9 @@ public class UpdateProfileCommand implements LocalCommand {
             Optional<File> avatarFile = removeAvatar
                     ? Optional.absent()
                     : avatarPath == null ? null : Optional.of(new File(avatarPath));
-            m.setProfile(name, avatarFile);
+            m.setProfile(name, about, aboutEmoji, avatarFile);
         } catch (IOException e) {
-            System.err.println("UpdateAccount error: " + e.getMessage());
+            System.err.println("Update profile error: " + e.getMessage());
             return 3;
         }