From 6a7176bfa6cbea944a45e196a4fbc1bf6d867aef Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Wed, 9 Mar 2016 16:13:38 -0500 Subject: [PATCH] make some arguments to graph create_embed optional --- lib/api/graph.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/api/graph.js b/lib/api/graph.js index f01f318..680951f 100644 --- a/lib/api/graph.js +++ b/lib/api/graph.js @@ -48,10 +48,10 @@ function snapshot(query, from, to, eventQuery, callback){ *comment: create an embed graph of a metric query *params: * graph_json: The request array to pass create in the embed - * timeframe: (1_hour, 4_hours, 1_day, 2_days, and 1_week) - * size: (small, medium, large, xlarge) - * legend: yes or no - * title: The title of the embed + * timeframe: optional, one of ("1_hour", "4_hours", "1_day", "2_days", and "1_week") + * size: optional, one of ("small", "medium", "large", "xlarge") + * legend: optional, "yes" or "no" + * title: optional, the title of the embed * callback: function(err, res) *example: | * ```javascript @@ -103,7 +103,8 @@ module.exports = { createEmbed: createEmbed, getUsage: function(){ return [ - " dogapi graph snapshot [--events ]" + " dogapi graph snapshot [--events ]", + " dogapi graph create_embed [--timeframe ] [--size ] [--legend ] [--title ]" ]; }, getHelp: function(){ @@ -111,14 +112,13 @@ module.exports = { "Graph:", " Subcommands:", " snapshot <query> <from> <to> --events <event-query> | take a snapshot of a graph", - " create_embed --graph_json <graph_json> --timeframe <timeframe> --size <size> --legend <legend> --title <title> | create a new graph embed", + " create_embed <graph_json> --timeframe <timeframe> --size <size> --legend <legend> --title <title> | create a new graph embed", " Options:", - " --events <event-query> a query for event bands to add to the snapshot", - " --graph_json <graph_json> <required> The json object to send to the DataDog", - " --timeframe <timeframe> <required> The timeframe for the embed (1_hour, 4_hours, 1_day, 2_days, and 1_week)", - " --size <size> <required> The size of the graph to create (small, medium, large, xlarge)", - " --legend <legend> <required> Whether or not to have a legend (yes, no)", - " --title <title> <required> The title of the embed to create" + " --events <event-query> a query for event bands to add to the snapshot", + " --timeframe <timeframe> The timeframe for the embed (1_hour, 4_hours, 1_day, 2_days, and 1_week)", + " --size <size> The size of the graph to create (small, medium, large, xlarge)", + " --legend <legend> Whether or not to have a legend (yes, no)", + " --title <title> The title of the embed to create" ]; }, @@ -129,8 +129,8 @@ module.exports = { var to = parseInt(args._[6]); var eventQuery = args["events"]; snapshot(query, from, to, eventQuery, callback); - } else if (subcommand === "create_embed") { - var graph_json = json.parse(args["graph_json"]); + } else if (args._.length > 4 && subcommand === "create_embed") { + var graph_json = json.parse(args._[4]); var timeframe = args["timeframe"]; var size = args["size"]; var legend = args["legend"];