leonard.se
2022-03-01 c6e76869f5a02cd52b8f4f9c7d78c0b433b22997
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package za.co.taulite.tools.smppclient;
 
import org.jline.utils.AttributedString;
import org.jline.utils.AttributedStyle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.shell.jline.PromptProvider;
import org.springframework.stereotype.Component;
//import za.co.taulite.mshell.events.MSLoginEvent;
//import za.co.taulite.mshell.services.MSAuthService;
import za.co.taulite.tools.smppclient.services.SmppService;
 
import javax.annotation.PostConstruct;
 
@Component
public class MSPromptProvider implements PromptProvider {
 
    @Autowired
    private SmppService smppService;
 
    private String systemId = "";
 
    @PostConstruct
    public void init() {
//        if (authService.isLoggedIn()) {
//            this.username = authService.getUser().getUsername();
//        }
    }
 
//    @EventListener
//    public void onLogin(MSLoginEvent loginEvent) {
//        this.username = loginEvent.getUsername() == null ? "" : loginEvent.getUsername();
//    }
 
    @Override
    public AttributedString getPrompt() {
        //return new AttributedString(String.format("ยต %s$ ", username), AttributedStyle.DEFAULT.foreground(AttributedStyle.YELLOW));
        return new AttributedString("$ ");
    }
}