From 2dcdb3e606158c531594fa58e60b2d4e4be8cd79 Mon Sep 17 00:00:00 2001
From: Florent Gluck <florent.gluck@hesge.ch>
Date: Tue, 30 Aug 2022 22:23:40 +0200
Subject: [PATCH] =?UTF-8?q?nexush:=20fixed=20bug=20introduced=20in=20the?=
 =?UTF-8?q?=20last=20commit=20where=20some=20garbage=20characters=20were?=
 =?UTF-8?q?=20commited=20in=20the=20source=20code.=20Also=20vmlist=20and?=
 =?UTF-8?q?=20usersetcaps=20commands=20were=20removed=20by=20accident.=20F?=
 =?UTF-8?q?ixed=20ticket:=20=20"pr=C3=A9fixer=20le=20n=C2=B0=20de=20VM=20l?=
 =?UTF-8?q?ors=20de=20cr=C3=A9ation=20multiples"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/cmdVM/vmCreate.go | 5 ++++-
 src/nexush/nexush.go  | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/cmdVM/vmCreate.go b/src/cmdVM/vmCreate.go
index a8ab374..a436799 100644
--- a/src/cmdVM/vmCreate.go
+++ b/src/cmdVM/vmCreate.go
@@ -2,6 +2,7 @@ package cmdVM
 
 import (
 	"os"
+	"fmt"
 	"errors"
 	"strconv"
 	"encoding/csv"
@@ -111,11 +112,13 @@ func (cmd *Create)Run(args []string) int {
 	}
 
 	statusCode := 0
+	digits := len(strconv.Itoa(count))
 
 	for i := 1; i <= count; i++ {
 		if csvEntries == nil {
 			if count > 1 {
-				vmArgs.Name = name+" ["+strconv.Itoa(i)+"]"
+				numberPadded := fmt.Sprintf("%0"+strconv.Itoa(digits)+"d", i)
+				vmArgs.Name = name+" ["+numberPadded+"]"
 			}
 		} else {
 			vmArgs.Name = name+" ["+csvEntries[i-1]+"]"
diff --git a/src/nexush/nexush.go b/src/nexush/nexush.go
index 1dbfe3c..27c1744 100644
--- a/src/nexush/nexush.go
+++ b/src/nexush/nexush.go
@@ -28,7 +28,10 @@ var cmdList = []cmd.Command {
 	&cmdUser.UpdatePwd{"passwd"},
 	&cmdUser.List{"userlist"},
 	&cmdUser.Add{"useradd"},
-	&cmdUser.Del{"userdel"},PrintlnErr
+	&cmdUser.Del{"userdel"},
+	&cmdUser.SetCaps{"usersetcaps"},
+
+	&cmdVM.List{"vmlist"},
 	&cmdVM.ListStart{"vmliststart"},
 	&cmdVM.ListAttach{"vmlistattach"},
 	&cmdVM.ListStop{"vmliststop"},
-- 
GitLab