Config::Pit(3pm)

πŸ“¦
version 0.04 Β· 2 versions
  • 0.04 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.04 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Config::Pit β€” the manual page, but make it a group chat πŸ’–

okay bestie, so this is Config::Pit from the User Contributed Perl Documentation section, and it's literally the library that manages all ur settings so u never have to hardcode a password again. iykyk. ✨


🌸 NAME 🌸

Config::Pit β€” Manage settings πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

use Config::Pit;

my $config = pit_get("example.com", require => {
  "username" => "your username on example",
  "password" => "your password on example"
});
# if the fields are not set, open setting by $EDITOR
# with YAML-dumped default values (specified at C<require>).

# use $config->{username}, $config->{password}

so like. if the fields aren't set yet, it opens up the setting with $EDITOR for u, prefilled with YAML-dumped default values (the ones u specified at require). then u just use $config->{username} and $config->{password}. slay. πŸ’…


✨ DESCRIPTION ✨

Config::Pit is an account setting management library. it literally automates editing the settings ur scripts use, so ur not out here hand-editing config files like it's 2009. 🫢

the original library is written in Ruby and published as the pit gem, with a management command. iconic ancestry fr fr.

u can install it by rubygems:

$ sudo gem install pit
$ pit set example.com
# open setting of example.com with $EDITOR.

and Config::Pit provides the ppit command, which is the pit command but written in Perl. the glow-up. 🌈

See:

$ ppit help

πŸ‘‘ FUNCTIONS πŸ‘‘

πŸ“ Config::Pit::get(setting_name, opts)

get the setting named "setting_name" from the current profile. πŸ’–

my $config = Config::Pit::get("example.com");

this is the exact same as this:

my $config = pit_get("example.com");

opts:

  • require β€” specify the fields u want as the key, and a hint (description or default value) of that field as the value. like so:
my $config = pit_get("example.com", require => {
  "username" => "your username on example.com",
  "password" => "your password on example.com"
});
when "require" is specified, the module checks that all the required fields exist in the setting. if they don't exist, it opens the setting with $EDITOR, using a merged setting (the current setting + ur stuff). bestie it will literally hold ur hand. 🀝

🧚 Config::Pit::set(setting_name, opts)

set the setting named "setting_name" to the current profile. 🌸

Config::Pit::set("example.com"); #=> will open setting with $EDITOR

opts:

  • data β€”
Config::Pit::set("example.com", data => {
  username => "foobar",
  password => "barbaz",
});

when "data" is specified, it will not open $EDITOR β€” it just sets the data directly. no editor, no vibe check, straight to business. πŸ”₯

  • config β€”
Config::Pit::set("example.com", config => {
  username => "config description or default value",
  password => "same as above",
});

this one opens $EDITOR with a merged setting (current setting + the config u specified). ✨


πŸ’œ Config::Pit::switch(profile_name);

switch the profile to "profile_name". πŸ¦‹

a profile is a set of settings. watch the main character energy:

$ pit get foobar
# foo bar...

$ pit switch devel
Switch profile to devel

$ pit get foobar
# bar baz

$ pit switch
Switch profile to default

$ pit get foobar
# foo bar...

see how it came back to the default? periodt. πŸ’…


πŸŽ€ AUTHOR πŸŽ€

cho45 <cho45@lowreal.net> β€” the icon, the legend, the moment. πŸ‘‘


πŸ’– LICENSE πŸ’–

this library is free software; u can redistribute it and/or modify it under the same terms as Perl itself. 🌈


⭐ SEE ALSO ⭐


and that's the whole thing bestie, no cap. this page came from perl v5.36.0, dated 2022-12-07, and honestly? iconic. stay config'd, stay hydrated, and go set ur passwords properly for once. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ˜­πŸ”₯πŸ‘‘πŸŒˆβ­πŸ’€πŸ™ˆπŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from