nodes: 0, module; 1, function_definition; 2, function_name:_show_documentation; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, while_statement; 15, comment:"""
          Shows all documents of the current groundwork app in the console.
  
          Documents are sorted bei its names, except "main", which gets set to the beginning.
          """; 16, assignment; 17, pattern_list; 18, call; 19, block; 20, assignment; 21, assignment; 22, comparison_operator:main is not None; 23, block; 24, assignment; 25, assignment; 26, comparison_operator:user_answer != "X"; 27, block; 28, identifier:documents; 29, list; 30, identifier:key; 31, identifier:document; 32, attribute; 33, argument_list; 34, if_statement; 35, identifier:documents; 36, call; 37, identifier:main; 38, call; 39, identifier:main; 40, None; 41, expression_statement; 42, identifier:user_answer; 43, string:""; 44, identifier:index; 45, integer:0; 46, identifier:user_answer; 47, string:"X"; 48, if_statement; 49, if_statement; 50, expression_statement; 51, expression_statement; 52, expression_statement; 53, expression_statement; 54, expression_statement; 55, expression_statement; 56, expression_statement; 57, expression_statement; 58, if_statement; 59, if_statement; 60, expression_statement; 61, expression_statement; 62, if_statement; 63, expression_statement; 64, if_statement; 65, call; 66, identifier:items; 67, comparison_operator:key != "main"; 68, block; 69, identifier:sorted; 70, argument_list; 71, attribute; 72, argument_list; 73, call; 74, comparison_operator:index < 0; 75, block; 76, comparison_operator:index > len(documents) - 1; 77, block; 78, assignment; 79, call; 80, call; 81, assignment; 82, call; 83, call; 84, call; 85, assignment; 86, comparison_operator:index < len(documents) - 1; 87, block; 88, comparison_operator:index > 0; 89, block; 90, augmented_assignment; 91, call; 92, comparison_operator:index < len(documents) - 1; 93, block; 94, elif_clause; 95, else_clause; 96, assignment; 97, comparison_operator:user_answer == "N"; 98, block; 99, elif_clause; 100, attribute; 101, argument_list; 102, identifier:key; 103, string:"main"; 104, expression_statement; 105, identifier:documents; 106, keyword_argument; 107, attribute; 108, identifier:get; 109, string:"main"; 110, attribute; 111, argument_list; 112, identifier:index; 113, integer:0; 114, expression_statement; 115, identifier:index; 116, binary_operator:len(documents) - 1; 117, expression_statement; 118, identifier:document; 119, subscript; 120, attribute; 121, argument_list; 122, identifier:echo; 123, argument_list; 124, identifier:source; 125, binary_operator:"This document is registered by '%s' under the name '%s'" % (document.plugin.name, document.name); 126, identifier:echo; 127, argument_list; 128, identifier:echo; 129, argument_list; 130, identifier:echo; 131, argument_list; 132, identifier:commands; 133, string:"Actions: "; 134, identifier:index; 135, binary_operator:len(documents) - 1; 136, expression_statement; 137, identifier:index; 138, integer:0; 139, expression_statement; 140, identifier:commands; 141, string:"E[x]it"; 142, identifier:echo; 143, argument_list; 144, identifier:index; 145, binary_operator:len(documents) - 1; 146, expression_statement; 147, comparison_operator:index > 0; 148, block; 149, block; 150, identifier:user_answer; 151, call; 152, identifier:user_answer; 153, string:"N"; 154, expression_statement; 155, comparison_operator:user_answer == "P"; 156, block; 157, attribute; 158, identifier:get; 159, call; 160, identifier:key; 161, lambda; 162, attribute; 163, identifier:documents; 164, identifier:documents; 165, identifier:insert; 166, integer:0; 167, tuple; 168, assignment; 169, call; 170, integer:1; 171, assignment; 172, subscript; 173, integer:1; 174, identifier:os; 175, identifier:system; 176, conditional_expression:'cls' if os.name == 'nt' else 'clear'; 177, call; 178, string:"This document is registered by '%s' under the name '%s'"; 179, tuple; 180, binary_operator:"-" * len(source); 181, identifier:source; 182, binary_operator:"-" * len(source); 183, call; 184, integer:1; 185, augmented_assignment; 186, augmented_assignment; 187, identifier:commands; 188, call; 189, integer:1; 190, assignment; 191, identifier:index; 192, integer:0; 193, expression_statement; 194, expression_statement; 195, attribute; 196, argument_list; 197, augmented_assignment; 198, identifier:user_answer; 199, string:"P"; 200, expression_statement; 201, attribute; 202, identifier:documents; 203, attribute; 204, argument_list; 205, lambda_parameters; 206, subscript; 207, identifier:self; 208, identifier:app; 209, attribute; 210, identifier:main; 211, identifier:index; 212, integer:0; 213, identifier:len; 214, argument_list; 215, identifier:index; 216, binary_operator:len(documents) - 1; 217, identifier:documents; 218, identifier:index; 219, string; 220, comparison_operator:os.name == 'nt'; 221, string; 222, attribute; 223, argument_list; 224, attribute; 225, attribute; 226, string:"-"; 227, call; 228, string:"-"; 229, call; 230, identifier:len; 231, argument_list; 232, identifier:commands; 233, string:"[N]ext, "; 234, identifier:commands; 235, string:"[P]revious, "; 236, identifier:len; 237, argument_list; 238, identifier:default; 239, string:"N"; 240, assignment; 241, assignment; 242, call; 243, identifier:upper; 244, identifier:index; 245, integer:1; 246, augmented_assignment; 247, identifier:self; 248, identifier:app; 249, identifier:documents; 250, identifier:append; 251, tuple; 252, identifier:x; 253, identifier:x; 254, integer:0; 255, identifier:main; 256, identifier:name; 257, identifier:documents; 258, call; 259, integer:1; 260, string_content:cls; 261, attribute; 262, string; 263, string_content:clear; 264, call; 265, identifier:render; 266, keyword_argument; 267, keyword_argument; 268, attribute; 269, identifier:name; 270, identifier:document; 271, identifier:name; 272, identifier:len; 273, argument_list; 274, identifier:len; 275, argument_list; 276, identifier:documents; 277, identifier:documents; 278, identifier:default; 279, string:"P"; 280, identifier:default; 281, string:"X"; 282, identifier:prompt; 283, argument_list; 284, identifier:index; 285, integer:1; 286, identifier:key; 287, identifier:document; 288, identifier:len; 289, argument_list; 290, identifier:os; 291, identifier:name; 292, string_content:nt; 293, attribute; 294, argument_list; 295, identifier:app; 296, attribute; 297, identifier:plugin; 298, attribute; 299, identifier:document; 300, identifier:plugin; 301, identifier:source; 302, identifier:source; 303, string:"Select your action"; 304, keyword_argument; 305, identifier:documents; 306, call; 307, identifier:from_string; 308, attribute; 309, identifier:self; 310, identifier:app; 311, identifier:document; 312, identifier:plugin; 313, identifier:default; 314, identifier:default; 315, identifier:Environment; 316, argument_list; 317, identifier:document; 318, identifier:content
code: def _show_documentation(self):
          """
          Shows all documents of the current groundwork app in the console.
  
          Documents are sorted bei its names, except "main", which gets set to the beginning.
          """
          documents = []
          for key, document in self.app.documents.get().items():
              if key != "main":
                  documents.append((key, document))
          documents = sorted(documents, key=lambda x: x[0])
          main = self.app.documents.get("main")
          if main is not None:
              documents.insert(0, (main.name, main))
  
          user_answer = ""
          index = 0
          while user_answer != "X":
              if index < 0:
                  index = 0
              if index > len(documents) - 1:
                  index = len(documents) - 1
              document = documents[index][1]
  
              os.system('cls' if os.name == 'nt' else 'clear')
              echo(Environment().from_string(document.content).render(app=self.app, plugin=document.plugin))
  
              source = "This document is registered by '%s' under the name '%s'" % (document.plugin.name, document.name)
              echo("-" * len(source))
              echo(source)
              echo("-" * len(source))
              commands = "Actions: "
              if index < len(documents) - 1:
                  commands += "[N]ext, "
              if index > 0:
                  commands += "[P]revious, "
              commands += "E[x]it"
              echo(commands)
  
              if index < len(documents) - 1:
                  default = "N"
              elif index > 0:
                  default = "P"
              else:
                  default = "X"
              user_answer = prompt("Select your action", default=default).upper()
  
              if user_answer == "N":
                  index += 1
              elif user_answer == "P":
                  index -= 1