-
Notifications
You must be signed in to change notification settings - Fork 24
/
del.go
34 lines (28 loc) · 1023 Bytes
/
del.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2018-2021, Sylabs Inc. All rights reserved.
// Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
// Copyright (c) 2017, Yannick Cote <yhcote@gmail.com> All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE file distributed with the sources of this project regarding your
// rights to use or distribute this software.
package siftool
import (
"fmt"
"strconv"
"github.com/hpcng/sif/internal/app/siftool"
"github.com/spf13/cobra"
)
// Del implements 'siftool del' sub-command.
func Del() *cobra.Command {
return &cobra.Command{
Use: "del <descriptorid> <containerfile>",
Short: "Delete a specified object descriptor and data from SIF file",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
id, err := strconv.ParseUint(args[0], 10, 32)
if err != nil {
return fmt.Errorf("while converting input descriptor id: %s", err)
}
return siftool.Del(args[1], uint32(id))
},
}
}