cmd/commands_http: clean Int options handling
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 15 May 2018 17:43:34 +0000 (13:43 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 21 Jun 2018 00:45:30 +0000 (20:45 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/doc/commands/commands_http.nit

index 9a1df88..468cb5c 100644 (file)
@@ -39,8 +39,10 @@ end
 
 redef class CmdList
        redef fun http_init(req) do
-               limit = req.int_arg("l")
-               page = req.int_arg("p")
+               var opt_limit = req.int_arg("l")
+               if opt_limit != null then limit = opt_limit
+               var opt_page = req.int_arg("p")
+               if opt_page != null then page = opt_page
                return super
        end
 end
@@ -163,8 +165,10 @@ end
 
 redef class CmdInheritanceGraph
        redef fun http_init(req) do
-               pdepth = req.int_arg("pdepth")
-               cdepth = req.int_arg("cdepth")
+               var opt_pdepth = req.int_arg("pdepth")
+               if opt_pdepth != null then pdepth = opt_pdepth
+               var opt_cdepth = req.int_arg("cdepth")
+               if opt_cdepth != null then cdepth = opt_cdepth
                return super
        end
 end