import useKeyCommand, { KeyInput } from './useKeyCommand';
import { StoredCommand } from '../types';
import { useCallback } from 'react';

export default (
  executeCommand: (command: StoredCommand, settings?: any) => void,
  inputKey: KeyInput,
  command: StoredCommand,
) => {
  const fn = useCallback(
    () => executeCommand(command),
    [command, executeCommand]
  );

  return useKeyCommand(inputKey, fn)
}
