fabric: add module
This commit is contained in:
parent
f3ff73a5e1
commit
61c84a3bbf
5 changed files with 176 additions and 0 deletions
39
tests/modules/programs/fabric-ai/bashrc
Normal file
39
tests/modules/programs/fabric-ai/bashrc
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
|
||||
# Commands that should be applied only for interactive shells.
|
||||
[[ $- == *i* ]] || return
|
||||
|
||||
HISTFILESIZE=100000
|
||||
HISTSIZE=10000
|
||||
|
||||
shopt -s histappend
|
||||
shopt -s checkwinsize
|
||||
shopt -s extglob
|
||||
shopt -s globstar
|
||||
shopt -s checkjobs
|
||||
|
||||
|
||||
|
||||
if [[ ! -v BASH_COMPLETION_VERSINFO ]]; then
|
||||
. "@bash-completion@/etc/profile.d/bash_completion.sh"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
yt() {
|
||||
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ]; then
|
||||
echo "Usage: yt [-t | --timestamps] youtube-link"
|
||||
echo "Use the '-t' flag to get the transcript with timestamps."
|
||||
return 1
|
||||
fi
|
||||
|
||||
transcript_flag="--transcript"
|
||||
if [ "$1" = "-t" ] || [ "$1" = "--timestamps" ]; then
|
||||
transcript_flag="--transcript-with-timestamps"
|
||||
shift
|
||||
fi
|
||||
local video_link="$1"
|
||||
fabric -y "$video_link" $transcript_flag
|
||||
}
|
||||
|
||||
|
||||
3
tests/modules/programs/fabric-ai/default.nix
Normal file
3
tests/modules/programs/fabric-ai/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
fabric-ai-example-config = ./example-config.nix;
|
||||
}
|
||||
16
tests/modules/programs/fabric-ai/example-config.nix
Normal file
16
tests/modules/programs/fabric-ai/example-config.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
programs.bash.enable = true;
|
||||
programs.zsh.enable = true;
|
||||
programs.fabric-ai = {
|
||||
enable = true;
|
||||
enablePattersAliases = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileExists home-files/.zshrc
|
||||
|
||||
assertFileContent home-files/.bashrc ${./bashrc}
|
||||
assertFileContent home-files/.zshrc ${./zshrc}
|
||||
'';
|
||||
}
|
||||
46
tests/modules/programs/fabric-ai/zshrc
Normal file
46
tests/modules/programs/fabric-ai/zshrc
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
typeset -U path cdpath fpath manpath
|
||||
for profile in ${(z)NIX_PROFILES}; do
|
||||
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
|
||||
done
|
||||
|
||||
HELPDIR="@zsh@/share/zsh/$ZSH_VERSION/help"
|
||||
|
||||
autoload -U compinit && compinit
|
||||
# History options should be set in .zshrc and after oh-my-zsh sourcing.
|
||||
# See https://github.com/nix-community/home-manager/issues/177.
|
||||
HISTSIZE="10000"
|
||||
SAVEHIST="10000"
|
||||
|
||||
HISTFILE="/home/hm-user/.zsh_history"
|
||||
mkdir -p "$(dirname "$HISTFILE")"
|
||||
|
||||
setopt HIST_FCNTL_LOCK
|
||||
unsetopt APPEND_HISTORY
|
||||
setopt HIST_IGNORE_DUPS
|
||||
unsetopt HIST_IGNORE_ALL_DUPS
|
||||
unsetopt HIST_SAVE_NO_DUPS
|
||||
unsetopt HIST_FIND_NO_DUPS
|
||||
setopt HIST_IGNORE_SPACE
|
||||
unsetopt HIST_EXPIRE_DUPS_FIRST
|
||||
setopt SHARE_HISTORY
|
||||
unsetopt EXTENDED_HISTORY
|
||||
|
||||
|
||||
|
||||
|
||||
yt() {
|
||||
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ]; then
|
||||
echo "Usage: yt [-t | --timestamps] youtube-link"
|
||||
echo "Use the '-t' flag to get the transcript with timestamps."
|
||||
return 1
|
||||
fi
|
||||
|
||||
transcript_flag="--transcript"
|
||||
if [ "$1" = "-t" ] || [ "$1" = "--timestamps" ]; then
|
||||
transcript_flag="--transcript-with-timestamps"
|
||||
shift
|
||||
fi
|
||||
local video_link="$1"
|
||||
fabric -y "$video_link" $transcript_flag
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue