Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InABox: Add support for /region alias for /datacentre #236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lerlacher-fm
Copy link
Contributor

I always type "/region" on the first try because I've spent too much time in the cloud so region is the natural concept in my head rather than datacentre. So let's make the robot accomodate the human.

@@ -159,15 +159,23 @@ command box => {

my %switches = map { my ($k, @rest) = @$_; $k => \@rest } @$switches;

if (!exists $switches{datacentre}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the end goal here is that datacentre, datacenter, and region all mean the same thing, and providing more than 1 of them is a mistake. I think we can simplify this greatly with:

  my @got = grep { exists $switches{$_} } qw(datacenter datacentre region);

  if (@got > 1) {
    die "The following options are mutually exclusive: @got\n";
  }

  $switches{datacentre} = delete $switches{$got[0]};

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that looks much cleaner! Let me test if this works in all cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this and slightly adjusted it to make it all work nicely.

@rjbs rjbs force-pushed the main branch 2 times, most recently from 542b6ec to 091bf32 Compare June 27, 2024 18:04
@lerlacher-fm lerlacher-fm force-pushed the le-box-create-region branch 3 times, most recently from d84d769 to 33e8ab1 Compare June 28, 2024 00:16
lib/Synergy/Reactor/InABox.pm Outdated Show resolved Hide resolved
lib/Synergy/Reactor/InABox.pm Show resolved Hide resolved
lib/Synergy/Reactor/InABox.pm Outdated Show resolved Hide resolved
@rjbs rjbs force-pushed the main branch 3 times, most recently from 747f6ee to 10212ce Compare July 5, 2024 14:02
I always type "/region" on the first try because I've spent too much
time in the cloud so region is the natural concept in my head rather
than datacentre. So let's make the robot accomodate the human.
@lerlacher-fm
Copy link
Contributor Author

@rjbs I have applied your suggestions, rebased, and gave it a very rudimentary test-drive.

@rjbs rjbs self-requested a review July 12, 2024 02:09
@rjbs
Copy link
Member

rjbs commented Jul 12, 2024

@lerlacher-fm Thanks for humoring me, change looks good (and did indeed drop some complexity imho). 👍🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants