考虑使用cmd
模块的最小程序:
ref?.child("transactions").child(email).observeSingleEvent(of: .value, with: { (snapshot) in
let childrenCount = snapshot.childrenCount
var counter : Int = 0
for trans in snapshot.children.allObjects as! [DataSnapshot]
{
counter = counter + 1
self.ref?.child("transactions").child(email).child(trans.key).observeSingleEvent(of: .value, with: { (snapshot2) in
以下是与此程序的交互示例:
import cmd
class Shell(cmd.Cmd):
def do_input(self, _arg):
'''Ask the user to input a string.'''
s = input('String: ')
print(s)
if __name__ == '__main__':
Shell().cmdloop()
现在的问题是,按下向上键盘按钮时,最后的历史记录项来自用户输入(即(Cmd) input
String: Hello!
Hello!
(Cmd)
),而不是外壳程序的提示符(即Hello!
)。
问题是:如何仅获取在shell提示符下输入的命令的历史记录(而没有使用input
输入的输入的历史记录?)?