55#include < string>
66#include < vector>
77
8+ // embedded data generated by cmake
9+ extern const char * LICENSES [];
10+
811// visible
912int llama_server (int argc, char ** argv);
1013int llama_cli (int argc, char ** argv);
@@ -21,6 +24,7 @@ static const char * progname;
2124
2225static int help (int argc, char ** argv);
2326static int version (int argc, char ** argv);
27+ static int licenses (int argc, char ** argv);
2428
2529struct command {
2630 const char * name;
@@ -40,6 +44,7 @@ static const command cmds[] = {
4044 {" quantize" , " Quantize a model" , {}, true , llama_quantize },
4145 {" perplexity" , " Compute model perplexity and KL divergence" , {}, true , llama_perplexity },
4246 {" version" , " Show version" , {}, false , version },
47+ {" licenses" , " Show third-party licenses" , {" credits" }, false , licenses },
4348 {" help" , " Show available commands" , {}, false , help },
4449};
4550
@@ -48,6 +53,13 @@ static int version(int argc, char ** argv) {
4853 return 0 ;
4954}
5055
56+ static int licenses (int argc, char ** argv) {
57+ for (int i = 0 ; LICENSES [i]; ++i) {
58+ printf (" %s\n " , LICENSES [i]);
59+ }
60+ return 0 ;
61+ }
62+
5163static int help (int argc, char ** argv) {
5264 const bool show_all = argc >= 2 && std::string (argv[1 ]) == " all" ;
5365
0 commit comments