6565#include < filesystem>
6666#include < functional>
6767#include < climits>
68- #include < functional>
69- #include < climits>
7068
7169namespace vix
7270{
@@ -427,8 +425,11 @@ namespace vix
427425 if (!args.empty ())
428426 {
429427 const std::string &cmd = args[0 ];
428+
430429 if (cmd == " new" )
431430 return commands::NewCommand::help ();
431+ if (cmd == " make" )
432+ return commands::MakeCommand::help ();
432433 if (cmd == " build" )
433434 return commands::BuildCommand::help ();
434435 if (cmd == " run" )
@@ -437,72 +438,82 @@ namespace vix
437438 return commands::DevCommand::help ();
438439 if (cmd == " replay" )
439440 return commands::ReplayCommand::help ();
440- if (cmd == " orm" )
441- return commands::OrmCommand::help ();
442- if (cmd == " pack" )
443- return commands::PackCommand::help ();
444- if (cmd == " verify" )
445- return commands::VerifyCommand::help ();
446441 if (cmd == " check" )
447442 return commands::CheckCommand::help ();
448443 if (cmd == " tests" || cmd == " test" )
449444 return commands::TestsCommand::help ();
450445 if (cmd == " repl" )
451446 return commands::ReplCommand::help ();
447+ if (cmd == " fmt" )
448+ return commands::FmtCommand::help ();
449+ if (cmd == " clean" )
450+ return commands::CleanCommand::help ();
451+ if (cmd == " reset" )
452+ return commands::ResetCommand::help ();
453+ if (cmd == " task" )
454+ return commands::TaskCommand::help ();
455+ if (cmd == " modules" )
456+ return commands::ModulesCommand::help ();
457+
458+ if (cmd.size () > 5 && cmd.rfind (" make:" , 0 ) == 0 )
459+ return commands::MakeCommand::help ();
460+
461+ if (cmd == " pack" )
462+ return commands::PackCommand::help ();
463+ if (cmd == " verify" )
464+ return commands::VerifyCommand::help ();
452465 if (cmd == " cache" )
453466 return commands::CacheCommand::help ();
454- if (cmd == " registry" )
455- return commands::RegistryCommand::help ();
467+
456468 if (cmd == " registry" )
457469 return commands::RegistryCommand::help ();
458470 if (cmd == " add" )
459471 return commands::AddCommand::help ();
460- if (cmd == " update" )
461- return commands::UpdateCommand::help ();
462- if (cmd == " outdated" )
463- return commands::OutdatedCommand::help ();
464472 if (cmd == " search" )
465473 return commands::SearchCommand::help ();
466474 if (cmd == " remove" )
467475 return commands::RemoveCommand::help ();
468476 if (cmd == " list" )
469477 return commands::ListCommand::help ();
478+ if (cmd == " update" || cmd == " up" )
479+ return commands::UpdateCommand::help ();
480+ if (cmd == " outdated" )
481+ return commands::OutdatedCommand::help ();
470482 if (cmd == " store" )
471483 return commands::StoreCommand::help ();
472484 if (cmd == " publish" )
473485 return commands::PublishCommand::help ();
474- if (cmd == " completion" )
475- return commands::CompletionCommand::help ();
476- if (cmd == " fmt" )
477- return commands::FmtCommand::help ();
478- if (cmd == " clean" )
479- return commands::CleanCommand::help ();
480- if (cmd == " reset" )
481- return commands::ResetCommand::help ();
482- if (cmd == " task" )
483- return commands::TaskCommand::help ();
486+ if (cmd == " unpublish" )
487+ return commands::UnpublishCommand{}.help ();
488+ if (cmd == " install" || cmd == " i" )
489+ return commands::InstallCommand::help ();
484490 if (cmd == " deps" )
485491 {
486492 vix::cli::util::warn_line (std::cout, " 'vix deps' is deprecated, use 'vix install'" );
487493 return commands::InstallCommand::help ();
488494 }
489495
490- if (cmd == " install" || cmd == " i" )
491- {
492- return commands::InstallCommand::help ();
493- }
494- if (cmd == " modules" )
495- return commands::ModulesCommand::help ();
496496 if (cmd == " p2p" )
497497 return commands::P2PCommand::help ();
498- if (cmd == " info" )
499- return commands::InfoCommand::help ();
498+ if (cmd == " orm" )
499+ return commands::OrmCommand::help ();
500+
501+ if (cmd == " completion" )
502+ return commands::CompletionCommand::help ();
500503 if (cmd == " upgrade" )
501504 return commands::UpgradeCommand::help ();
505+ if (cmd == " info" )
506+ return commands::InfoCommand::help ();
502507 if (cmd == " doctor" )
503508 return commands::DoctorCommand::help ();
504509 if (cmd == " uninstall" )
505510 return commands::UninstallCommand::help ();
511+
512+ vix::cli::util::err_line (
513+ std::cerr,
514+ " unknown help topic " + vix::cli::util::quote (cmd));
515+
516+ return 1 ;
506517 }
507518
508519#ifndef VIX_CLI_VERSION
@@ -511,99 +522,119 @@ namespace vix
511522
512523 std::ostream &out = std::cout;
513524
514- // Global padding helpers (2 spaces per level)
515525 auto indent = [](int level) -> std::string
516526 {
517527 return std::string (static_cast <size_t >(level) * 2 , ' ' );
518528 };
519529
520- auto docs = [&](const char *url )
530+ auto docs = [&](const char *path )
521531 {
522- out << indent (2 ) << " Docs: " << link (url) << " \n " ;
532+ out << indent (2 )
533+ << " Docs: "
534+ << link (std::string (" https://docs.vixcpp.com" ) + path)
535+ << " \n " ;
523536 };
524537
525538 out << " Vix.cpp\n " ;
526539 out << " Fast. Simple. Built for real apps.\n " ;
527540 out << " Version: " << VIX_CLI_VERSION << " \n\n " ;
528541
542+ out << indent (1 ) << " Usage:\n " ;
543+ out << indent (2 ) << " vix <command> [options]\n " ;
544+ out << indent (2 ) << " vix help [command]\n " ;
545+ out << indent (2 ) << " vix <file.cpp>\n " ;
546+ out << indent (2 ) << " vix make:<type> <name>\n\n " ;
547+
529548 out << indent (1 ) << " Core workflow:\n " ;
530- out << indent (2 ) << " add Add a dependency\n " ;
531- out << indent (2 ) << " install Install project dependencies\n " ;
532- out << indent (2 ) << " update Update dependencies\n " ;
533- out << indent (2 ) << " run Run your app\n " ;
534- out << indent (2 ) << " deploy Deploy your app (coming soon)\n\n " ;
549+ out << indent (2 ) << " new Create a new project\n " ;
550+ out << indent (2 ) << " add Add a dependency\n " ;
551+ out << indent (2 ) << " install Install dependencies\n " ;
552+ out << indent (2 ) << " run Build and run\n " ;
553+ out << indent (2 ) << " dev Start development mode\n " ;
554+ out << indent (2 ) << " build Build project or file\n\n " ;
535555
536556 out << indent (1 ) << " Commands:\n\n " ;
537557
538- // Project
539558 out << indent (2 ) << " Project:\n " ;
540- docs (" https://vixcpp.com/docs/modules/cli/new" );
541- out << indent (3 ) << " new <name> Create a new project\n " ;
542- out << indent (3 ) << " make Generate C++ scaffolding\n " ;
543- out << indent (3 ) << " dev Start dev server (hot reload)\n " ;
544- out << indent (3 ) << " replay Replay a recorded execution\n " ;
545- out << indent (3 ) << " run Build and run\n " ;
546- out << indent (3 ) << " build Build project\n " ;
547- out << indent (3 ) << " check Validate build or file\n " ;
548- out << indent (3 ) << " tests Run tests\n " ;
549- out << indent (3 ) << " fmt Format source code\n " ;
550- out << indent (3 ) << " clean Remove project cache\n " ;
551- out << indent (3 ) << " reset Clean and reinstall project\n " ;
552- out << indent (3 ) << " task Run reusable project tasks\n " ;
553- out << indent (3 ) << " repl Interactive REPL\n\n " ;
554-
555- // Dependencies
556- out << indent (2 ) << " Dependencies:\n " ;
557- docs (" https://vixcpp.com/docs/modules/cli/search" );
558- out << indent (3 ) << " add <pkg>@<ver> Add dependency\n " ;
559- out << indent (3 ) << " install Install dependencies\n " ;
560- out << indent (3 ) << " update Update dependencies\n " ;
561- out << indent (3 ) << " outdated Check available dependency updates\n " ;
562- out << indent (3 ) << " remove <pkg> Remove dependency\n " ;
563- out << indent (3 ) << " list List dependencies\n\n " ;
564-
565- out << indent (2 ) << " Aliases:\n " ;
566- out << indent (3 ) << " up Alias for update\n " ;
567- out << indent (3 ) << " i Alias for install\n " ;
568- out << indent (3 ) << " deps Legacy alias for install\n\n " ;
569-
570- // Packaging
571- out << indent (2 ) << " Build & share:\n " ;
572- docs (" https://vixcpp.com/docs/modules/cli/pack" );
573- out << indent (3 ) << " pack Build distributable package\n " ;
574- out << indent (3 ) << " verify Verify package integrity\n " ;
575- out << indent (3 ) << " cache Store package locally\n\n " ;
576-
577- // Advanced
578- out << indent (2 ) << " Advanced:\n " ;
579- out << indent (3 ) << " registry Sync/search packages\n " ;
580- out << indent (3 ) << " store Manage local cache\n " ;
581- out << indent (3 ) << " orm Database migrations\n " ;
582- out << indent (3 ) << " p2p Run P2P node\n\n " ;
583-
584- // System
559+ docs (" /cli/" );
560+ out << indent (3 ) << " new <name> Create a new Vix project\n " ;
561+ out << indent (3 ) << " make Generate C++ scaffolding\n " ;
562+ out << indent (3 ) << " make:<type> Shortcut for make subcommands\n " ;
563+ out << indent (3 ) << " build Configure and build project\n " ;
564+ out << indent (3 ) << " run Build if needed, then run\n " ;
565+ out << indent (3 ) << " dev Hot reload development mode\n " ;
566+ out << indent (3 ) << " replay Replay a recorded execution\n " ;
567+ out << indent (3 ) << " check Validate build or script\n " ;
568+ out << indent (3 ) << " tests Run tests\n " ;
569+ out << indent (3 ) << " test Alias for tests\n " ;
570+ out << indent (3 ) << " repl Start interactive REPL\n " ;
571+ out << indent (3 ) << " fmt Format C++ source files\n " ;
572+ out << indent (3 ) << " clean Remove local cache directories\n " ;
573+ out << indent (3 ) << " reset Clean cache and reinstall dependencies\n " ;
574+ out << indent (3 ) << " task Run reusable project tasks\n " ;
575+ out << indent (3 ) << " modules Manage optional project modules\n\n " ;
576+
577+ out << indent (2 ) << " Registry and dependencies:\n " ;
578+ docs (" /cli/registry" );
579+ out << indent (3 ) << " registry Sync/search the registry index\n " ;
580+ out << indent (3 ) << " add <pkg> Add dependency from registry\n " ;
581+ out << indent (3 ) << " search <query> Search packages offline\n " ;
582+ out << indent (3 ) << " remove <pkg> Remove dependency from vix.lock\n " ;
583+ out << indent (3 ) << " list List project dependencies\n " ;
584+ out << indent (3 ) << " install Install dependencies from vix.lock\n " ;
585+ out << indent (3 ) << " i Alias for install\n " ;
586+ out << indent (3 ) << " deps Deprecated alias for install\n " ;
587+ out << indent (3 ) << " update Update dependencies\n " ;
588+ out << indent (3 ) << " up Alias for update\n " ;
589+ out << indent (3 ) << " outdated Check outdated dependencies\n " ;
590+ out << indent (3 ) << " store Manage local store cache\n " ;
591+ out << indent (3 ) << " publish Publish a package version\n " ;
592+ out << indent (3 ) << " unpublish Remove a published package\n\n " ;
593+
594+ out << indent (2 ) << " Packaging:\n " ;
595+ docs (" /cli/pack" );
596+ out << indent (3 ) << " pack Create distributable package\n " ;
597+ out << indent (3 ) << " verify Verify package integrity\n " ;
598+ out << indent (3 ) << " cache Cache package into local store\n\n " ;
599+
600+ out << indent (2 ) << " Runtime and advanced:\n " ;
601+ docs (" /cli/commands" );
602+ out << indent (3 ) << " p2p Run P2P node/tools\n " ;
603+ out << indent (3 ) << " orm Database migrations/status/rollback\n\n " ;
604+
585605 out << indent (2 ) << " System:\n " ;
586- out << indent (3 ) << " info Show Vix paths and cache locations\n " ;
587- out << indent (3 ) << " doctor Check environment\n " ;
588- out << indent (3 ) << " upgrade Update Vix\n " ;
589- out << indent (3 ) << " uninstall Remove Vix\n\n " ;
606+ docs (" /cli/info" );
607+ out << indent (3 ) << " completion Generate shell completion script\n " ;
608+ out << indent (3 ) << " upgrade Upgrade the Vix CLI binary\n " ;
609+ out << indent (3 ) << " info Show environment and cache locations\n " ;
610+ out << indent (3 ) << " doctor Check toolchain and install health\n " ;
611+ out << indent (3 ) << " uninstall Remove Vix CLI from the system\n\n " ;
590612
591- // Help
592613 out << indent (2 ) << " Help:\n " ;
593- out << indent (3 ) << " help [command] Show command help\n " ;
594- out << indent (3 ) << " completion Generate shell completion script\n " ;
595- out << indent (3 ) << " version Show version\n\n " ;
614+ out << indent (3 ) << " help [command] Show command help\n " ;
615+ out << indent (3 ) << " version Show version\n " ;
616+ out << indent (3 ) << " -h, --help Show help\n " ;
617+ out << indent (3 ) << " -v, --version Show version\n\n " ;
596618
597619 out << indent (1 ) << " Global options:\n " ;
598- out << indent (2 ) << " --verbose Debug logs\n " ;
599- out << indent (2 ) << " -q, --quiet Only warnings/errors\n " ;
600- out << indent (2 ) << " --log-level trace|debug|info|warn|error|critical\n " ;
601- out << indent (2 ) << " -h, --help Show help\n " ;
602- out << indent (2 ) << " -v, --version Show version\n\n " ;
603-
604- out << indent (1 ) << " Docs: " << link (" https://vixcpp.com/docs" ) << " \n " ;
605- out << indent (1 ) << " Registry: " << link (" https://vixcpp.com/registry" ) << " \n " ;
606- out << indent (1 ) << " GitHub: " << link (" https://github.com/vixcpp/vix" ) << " \n\n " ;
620+ out << indent (2 ) << " --verbose Enable debug logs\n " ;
621+ out << indent (2 ) << " -q, --quiet Only warnings/errors\n " ;
622+ out << indent (2 ) << " --log-level trace|debug|info|warn|error|critical\n\n " ;
623+
624+ out << indent (1 ) << " Examples:\n " ;
625+ out << indent (2 ) << " vix new hello\n " ;
626+ out << indent (2 ) << " vix run main.cpp\n " ;
627+ out << indent (2 ) << " vix build main.cpp --out app\n " ;
628+ out << indent (2 ) << " vix make:class User\n " ;
629+ out << indent (2 ) << " vix add @cnerium/app\n " ;
630+ out << indent (2 ) << " vix install\n " ;
631+ out << indent (2 ) << " vix help run\n\n " ;
632+
633+ out << indent (1 ) << " Links:\n " ;
634+ out << indent (2 ) << " Docs: " << link (" https://docs.vixcpp.com" ) << " \n " ;
635+ out << indent (2 ) << " CLI: " << link (" https://docs.vixcpp.com/cli/" ) << " \n " ;
636+ out << indent (2 ) << " Registry: " << link (" https://registry.vixcpp.com" ) << " \n " ;
637+ out << indent (2 ) << " GitHub: " << link (" https://github.com/vixcpp/vix" ) << " \n\n " ;
607638
608639 return 0 ;
609640 }
0 commit comments