MCPcopy Index your code
hub / github.com/endbasic/endbasic / new

Method new

client/src/cmds.rs:60–112  ·  view source on GitHub ↗

Creates a new `LOGIN` command.

(
        service: Rc<RefCell<dyn Service>>,
        console: Rc<RefCell<dyn Console>>,
        storage: Rc<RefCell<Storage>>,
    )

Source from the content-addressed store, hash-verified

58impl LoginCommand {
59 /// Creates a new `LOGIN` command.
60 pub fn new(
61 service: Rc<RefCell<dyn Service>>,
62 console: Rc<RefCell<dyn Console>>,
63 storage: Rc<RefCell<Storage>>,
64 ) -> Rc<Self> {
65 Rc::from(Self {
66 metadata: CallableMetadataBuilder::new("LOGIN")
67 .with_async(true)
68 .with_syntax(&[
69 (
70 &[SingularArgSyntax::RequiredValue(
71 RequiredValueSyntax {
72 name: Cow::Borrowed("username"),
73 vtype: ExprType::Text,
74 },
75 ArgSepSyntax::End,
76 )],
77 None,
78 ),
79 (
80 &[
81 SingularArgSyntax::RequiredValue(
82 RequiredValueSyntax {
83 name: Cow::Borrowed("username"),
84 vtype: ExprType::Text,
85 },
86 ArgSepSyntax::Exactly(ArgSep::Long),
87 ),
88 SingularArgSyntax::RequiredValue(
89 RequiredValueSyntax {
90 name: Cow::Borrowed("password"),
91 vtype: ExprType::Text,
92 },
93 ArgSepSyntax::End,
94 ),
95 ],
96 None,
97 ),
98 ])
99 .with_category(CATEGORY)
100 .with_description(
101 "Logs into the user's account.
102On a successful login, this mounts your personal drive under the CLOUD:/ location, which you can \
103access with any other file-related commands. Using the cloud:// file system scheme, you can mount \
104other people's drives with the MOUNT command.
105To create an account, use the SIGNUP command.",
106 )
107 .build(),
108 service,
109 console,
110 storage,
111 })
112 }
113
114 /// Performs the login workflow against the server.
115 async fn do_login(&self, username: &str, password: &str) -> io::Result<()> {

Callers

nothing calls this directly

Calls 5

with_descriptionMethod · 0.80
with_categoryMethod · 0.80
with_syntaxMethod · 0.80
with_asyncMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected