github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/internal/assets/contents/activestate.yaml.perl.tpl (about)

     1  scripts:
     2    - name: activationMessage
     3      language: perl
     4      value: |
     5          $out = <<EOT;
     6              Quick Start
     7              ───────────
     8              • To add a package to your runtime, type "state install <package name>"
     9              • Learn more about how to use the State Tool, type "state learn"
    10          EOT
    11          $out =~ s/^ +//gm;
    12          print $out;
    13    - name: ppm
    14      language: perl
    15      value: |
    16          use strict;
    17          use warnings;
    18  
    19          $ENV{ACTIVESTATE_SHIM} = 'ppm';
    20  
    21          mapcmds((
    22              "install" => "install",
    23              "search"  => "search",
    24              "upgrade" => "install",
    25              "remove"  => "uninstall",
    26              "list"    => "packages",
    27          ));
    28  
    29          print("Could not shim your command as it is not supported by the State Tool.\nPlease check 'state --help' to find " .
    30              "the best analog for the command you're trying to run.\n" .
    31              "To configure this shim edit the following file:\n${project.path()}/activestate.yaml\n");
    32  
    33          sub mapcmds {
    34              my (%entries) = @_;
    35              while ((my $from, my $to) = each(%entries)) {
    36                  if ($ARGV[0] eq $from) {
    37                      printf("Shimming command to 'state %s', to configure this shim edit the following file:\n${project.path()}/activestate.yaml\n\n", $to);
    38                      system("state", $to, @ARGV[1 .. $#ARGV]);
    39                      exit($?);
    40                  }
    41              }
    42          }
    43  events:
    44    # This is the ACTIVATE event, it will run whenever a new virtual environment is created (eg. by running `state activate`)
    45    # On Linux and macOS this will be ran as part of your shell's rc file, so you can use it to set up aliases, functions, environment variables, etc.
    46    - name: ACTIVATE
    47      value: {{.LangExe}} $scripts.activationMessage.path()