@@ -477,6 +477,34 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
477
477
fs.write_contents (bashrc_path, Strings::join (" \n " , bashrc_content) + ' \n ' , VCPKG_LINE_INFO);
478
478
Checks::exit_success (VCPKG_LINE_INFO);
479
479
}
480
+
481
+ static void integrate_fish (const VcpkgPaths& paths)
482
+ {
483
+ fs::path fish_completions_path;
484
+ const auto config_path = System::get_environment_variable (" XDG_CONFIG_HOME" );
485
+ if (config_path.has_value ())
486
+ {
487
+ fish_completions_path = fs::path{config_path.value_or_exit (VCPKG_LINE_INFO)};
488
+ }
489
+ else
490
+ {
491
+ const auto home_path = System::get_environment_variable (" HOME" ).value_or_exit (VCPKG_LINE_INFO);
492
+ fish_completions_path = fs::path{home_path} / " .config" ;
493
+ }
494
+ fish_completions_path = fish_completions_path / " fish" / " completions" / " vcpkg.fish" ;
495
+
496
+ if (fs::stdfs::exists (fish_completions_path))
497
+ {
498
+ System::printf (" vcpkg fish completion is already added at %s.\n " , fs::u8string (fish_completions_path));
499
+ Checks::exit_success (VCPKG_LINE_INFO);
500
+ }
501
+
502
+ const fs::path completion_script_path = paths.scripts / " vcpkg_completion.fish" ;
503
+
504
+ System::printf (" Adding vcpkg completion entry at %s.\n " , fs::u8string (fish_completions_path));
505
+ fs::stdfs::create_symlink (completion_script_path, fish_completions_path);
506
+ Checks::exit_success (VCPKG_LINE_INFO);
507
+ }
480
508
#endif
481
509
482
510
void append_helpstring (HelpTableFormatter& table)
@@ -491,6 +519,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
491
519
table.format (" vcpkg integrate install" , " Make installed packages available user-wide" );
492
520
table.format (" vcpkg integrate remove" , " Remove user-wide integration" );
493
521
table.format (" vcpkg integrate bash" , " Enable bash tab-completion" );
522
+ table.format (" vcpkg integrate fish" , " Enable fish tab-completion" );
494
523
#endif // ^^^ !defined(_WIN32)
495
524
}
496
525
@@ -508,6 +537,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
508
537
static const std::string PROJECT = " project" ;
509
538
static const std::string POWERSHELL = " powershell" ;
510
539
static const std::string BASH = " bash" ;
540
+ static const std::string FISH = " x-fish" ;
511
541
}
512
542
513
543
static std::vector<std::string> valid_arguments (const VcpkgPaths&)
@@ -518,7 +548,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
518
548
#if defined(_WIN32)
519
549
Subcommand::PROJECT, Subcommand::POWERSHELL,
520
550
#else
521
- Subcommand::BASH,
551
+ Subcommand::BASH, Subcommand::FISH,
522
552
#endif
523
553
};
524
554
}
@@ -557,6 +587,10 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
557
587
{
558
588
return integrate_bash (paths);
559
589
}
590
+ if (args.command_arguments [0 ] == Subcommand::FISH)
591
+ {
592
+ return integrate_fish (paths);
593
+ }
560
594
#endif
561
595
562
596
Checks::exit_with_message (VCPKG_LINE_INFO, " Unknown parameter %s for integrate" , args.command_arguments [0 ]);
0 commit comments