Improve start.go usage msg
@@ -15,12 +15,14 @@ import (
* force -
*/
-const startUsage string = `The following actions will be performed on the host and in all relevant containers:
-- Extraction of libscope.so to /usr/lib/appscope/<version>/
-- Extraction of the filter input to /usr/lib/appscope/<version>/
+func getStartUsage(version string) string {
+ return fmt.Sprintf(`The following actions will be performed on the host and in all relevant containers:
+ - Extraction of libscope.so to /usr/lib/appscope/%s/
+ - Extraction of the filter input to /usr/lib/appscope/%s/
- Attach to all existing "allowed" processes defined in the filter file
-- Install etc/profile.d/scope.sh script to preload /usr/lib/appscope/<version>/libscope.so
-- Modify the relevant service configurations to preload /usr/lib/appscope/<version>/libscope.so`
+ - Install etc/profile.d/scope.sh script to preload /usr/lib/appscope/%s/libscope.so
+ - Modify the relevant service configurations to preload /usr/lib/appscope/%s/libscope.so`, version, version, version, version)
+}
// startCmd represents the start command
var startCmd = &cobra.Command{
@@ -28,7 +30,7 @@ var startCmd = &cobra.Command{
Short: "Start scoping a filtered selection of processes and services",
Long: `Start scoping a filtered selection of processes and services on the host and in all relevant containers.
-` + startUsage,
+` + getStartUsage("<version>"),
Example: ` scope start < example_filter.yml
cat example_filter.json | scope start`,
Args: cobra.NoArgs,
@@ -37,8 +39,8 @@ var startCmd = &cobra.Command{
force, _ := cmd.Flags().GetBool("force")
if !force {
- fmt.Printf(startUsage)
- fmt.Println("\n\nIf you wish to proceed, run again with the -f flag.")
+ fmt.Println(getStartUsage(internal.GetNormalizedVersion()))
+ fmt.Println("\nIf you wish to proceed, run again with the -f flag.")
os.Exit(0)
}
if err := start.Start(); err != nil {
