Skip to content

Commit c794db7

Browse files
Trim social follow action values (#737)
1 parent 8746190 commit c794db7

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

packages/cli/src/social-follow.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('social follow target parsing', () => {
2929
it('normalizes follow actions', () => {
3030
expect(normalizeFollowAction(undefined)).toBe('follow');
3131
expect(normalizeFollowAction('follow')).toBe('follow');
32+
expect(normalizeFollowAction(' unfollow ')).toBe('unfollow');
3233
expect(normalizeFollowAction('follow', true)).toBe('unfollow');
3334
expect(() => normalizeFollowAction('block')).toThrow('Expected --action follow or --action unfollow');
3435
});

packages/cli/src/social-follow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function parseSocialFollowTarget(input: string, explicitPlatform?: string
110110

111111
export function normalizeFollowAction(action: string | undefined, unfollow = false): SocialFollowAction {
112112
if (unfollow) return 'unfollow';
113-
const normalized = (action ?? 'follow').toLowerCase();
113+
const normalized = (action ?? 'follow').trim().toLowerCase();
114114
if (normalized === 'follow' || normalized === 'unfollow') return normalized;
115115
throw new Error(`Expected --action follow or --action unfollow; got "${action}"`);
116116
}

0 commit comments

Comments
 (0)