33
44declare (strict_types = 1 );
55
6- require __DIR__ . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . ' vendor ' . DIRECTORY_SEPARATOR . ' autoload.php ' ;
6+ require $ GLOBALS [ ' _composer_autoload_path ' ] ;
77
88require __DIR__ .DIRECTORY_SEPARATOR .'colors.php ' ;
99
@@ -15,41 +15,30 @@ function getArgv(string $index) : ? string {
1515}
1616
1717function usage () : void {
18- echo colorize (text : 'Usage : sessionbridge convert --from <format> --to <format> --session <source> ' ,fg : 'bright_yellow ' ,options : ['bold ' ]) , PHP_EOL ;
19- echo colorize (text : 'Example : php vendor/bin/sessionbridge convert --from telethon-sqlite --to liveproto-sqlite --session telethon.session ' ,fg : 'bright_blue ' ,options : ['underline ' ]) , PHP_EOL ;
18+ echo colorize (text : 'Usage : sessionbridge --from <format> --to <format> --session <source> ' ,fg : 'bright_yellow ' ,options : ['bold ' ]) , PHP_EOL ;
19+ echo colorize (text : 'Example : php vendor/bin/sessionbridge --from telethon-sqlite --to liveproto-sqlite --session telethon.session ' ,fg : 'bright_blue ' ,options : ['underline ' ]) , PHP_EOL ;
2020 exit (1 );
2121}
2222
23- $ args = array_slice ($ argv ,1 );
24-
25- if (count ($ args ) === 0 ) usage ();
26-
27- $ command = array_shift ($ args );
28-
29- if ($ command !== 'convert ' ):
30- echo colorize (text : '➥ Unknown command : ' .$ command ,bg : 'red ' ,options : ['bold ' ]) , PHP_EOL ;
31- usage ();
32- endif ;
33-
3423if (is_null (getArgv ('help ' )) === false ) usage ();
3524
3625$ from = str_replace (chr (45 ),chr (95 ),getArgv ('from ' ));
3726
3827if (function_exists ('Tak \\SessionBridge \\from_ ' .$ from ) === false ):
39- echo colorize (text : '➥ Unknown from : ' .$ from ,bg : 'red ' ,options : ['bold ' ]) , PHP_EOL ;
28+ echo colorize (text : '➥ Unknown from : ' .$ from ,fg : ' bright_cyan ' , bg : 'red ' ,options : ['bold ' ]) , PHP_EOL ;
4029 usage ();
4130endif ;
4231
4332$ to = str_replace (chr (45 ),chr (95 ),getArgv ('to ' ));
4433
4534if (function_exists ('Tak \\SessionBridge \\to_ ' .$ to ) === false ):
46- echo colorize (text : '➥ Unknown to : ' .$ to ,bg : 'red ' ,options : ['bold ' ]) , PHP_EOL ;
35+ echo colorize (text : '➥ Unknown to : ' .$ to ,fg : ' bright_cyan ' , bg : 'red ' ,options : ['bold ' ]) , PHP_EOL ;
4736 usage ();
4837endif ;
4938
5039$ source = getArgv ('session ' );
5140
52- echo colorize (text : 'ıllıllı Converting from ' .$ from .' to ' .$ to .' session ' ,fg : 'black ' ,bg : 'bright_yellow ' ) , PHP_EOL ;
41+ echo colorize (text : 'ıllıllı Converting from ' .$ from .' to ' .$ to .' session ' ,fg : 'bright_magenta ' ,bg : 'yellow ' ) , PHP_EOL ;
5342
5443try {
5544 $ sessions = call_user_func ('Tak \\SessionBridge \\from_ ' .$ from ,$ source );
0 commit comments