mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-13 06:40:41 +00:00
aptly graph specific output filename
https://github.com/smira/aptly/issues/241 modify: cmd/graph.go Signed-off-by: Zhang, Guodong <gdzhang@linx-info.com>
This commit is contained in:
@@ -35,8 +35,13 @@ func aptlyGraph(cmd *commander.Command, args []string) error {
|
|||||||
os.Remove(tempfile.Name())
|
os.Remove(tempfile.Name())
|
||||||
|
|
||||||
format := context.Flags().Lookup("format").Value.String()
|
format := context.Flags().Lookup("format").Value.String()
|
||||||
|
output := context.Flags().Lookup("output").Value.String()
|
||||||
|
|
||||||
tempfilename := tempfile.Name() + "." + format
|
tempfilename := tempfile.Name() + "." + format
|
||||||
|
if output != "" {
|
||||||
|
fmt.Printf("set file name option as %s . will output as %s.%s .\n", output, output, format)
|
||||||
|
tempfilename = output + "." + format
|
||||||
|
}
|
||||||
|
|
||||||
command := exec.Command("dot", "-T"+format, "-o"+tempfilename)
|
command := exec.Command("dot", "-T"+format, "-o"+tempfilename)
|
||||||
command.Stderr = os.Stderr
|
command.Stderr = os.Stderr
|
||||||
@@ -66,6 +71,7 @@ func aptlyGraph(cmd *commander.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fmt.Printf("Rendered to %s file: %s, trying to open it...\n", format, tempfilename)
|
fmt.Printf("Rendered to %s file: %s, trying to open it...\n", format, tempfilename)
|
||||||
|
|
||||||
_ = exec.Command("open", tempfilename).Run()
|
_ = exec.Command("open", tempfilename).Run()
|
||||||
@@ -90,6 +96,7 @@ Example:
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd.Flag.String("format", "png", "render graph to specified format (png, svg, pdf, etc.)")
|
cmd.Flag.String("format", "png", "render graph to specified format (png, svg, pdf, etc.)")
|
||||||
|
cmd.Flag.String("output", "", "specically output filename , default is output /tmp/aptlyxxxx.png")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user