MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / list_ftp

Method list_ftp

script/btcli.py:532–558  ·  view source on GitHub ↗

显示FTP列表

(self)

Source from the content-addressed store, hash-verified

530 return True
531
532 def list_ftp(self):
533 """显示FTP列表"""
534 try:
535 result = public.M('ftps').field('id,name,path,status,ps,addtime').select()
536
537 if not result:
538 print(Colors.warning("暂无FTP账户"))
539 return
540
541 headers = ["ID", "FTP用户名", "状态", "路径", "备注", "创建时间"]
542 rows = []
543
544 for ftp_user in result:
545 status = Colors.success("正常") if ftp_user['status'] == '1' else Colors.error("已禁用")
546 rows.append([
547 ftp_user['id'],
548 ftp_user['name'],
549 status,
550 ftp_user['path'][:40] + "..." if len(ftp_user['path']) > 40 else ftp_user['path'],
551 ftp_user.get('ps', '-')[:20],
552 ftp_user['addtime']
553 ])
554
555 TablePrinter.print_table(headers, rows, f"FTP账户列表 (共 {len(rows)} 个)")
556
557 except Exception as e:
558 print(Colors.error(f"获取FTP列表失败: {str(e)}"))
559
560 def add_ftp(self, username: str, password: str, path: str, **kwargs):
561 """

Callers 2

mainFunction · 0.95
ftp_menuMethod · 0.80

Calls 9

print_tableMethod · 0.80
selectMethod · 0.45
fieldMethod · 0.45
MMethod · 0.45
warningMethod · 0.45
successMethod · 0.45
errorMethod · 0.45
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected