From 8203d836c6daf456485af6cf5217af182e9e31c0 Mon Sep 17 00:00:00 2001 From: Thanos Kolovos Date: Fri, 25 Nov 2022 17:28:39 +0200 Subject: [PATCH] Make "pseudo" flag fixes * Abort when source is used with pseudo * Pass `pseudo` fix for local files --- cmd/tx/main.go | 8 ++++++++ internal/txlib/pull.go | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/cmd/tx/main.go b/cmd/tx/main.go index eb8d2db..331f038 100644 --- a/cmd/tx/main.go +++ b/cmd/tx/main.go @@ -580,6 +580,14 @@ func Main() { ) } + if arguments.Pseudo && arguments.Source { + return cli.Exit(errorColor( + "It doesn't make sense to use the '--pseudo' flag with the "+ + "CLI in \"source pull\" mode ('--source' flag). Please use with "+ + " translation files.", + ), 1) + } + if arguments.Source && !arguments.Translations && (arguments.All || len(arguments.Languages) > 0) { return cli.Exit(errorColor( diff --git a/internal/txlib/pull.go b/internal/txlib/pull.go index bd40772..165ca0b 100644 --- a/internal/txlib/pull.go +++ b/internal/txlib/pull.go @@ -244,6 +244,14 @@ func (task *ResourcePullTask) Run(send func(string), abort func()) { return } fileFilter := setFileTypeExtensions(args.FileType, cfgResource.FileFilter) + if args.Pseudo { + fileFilter = strings.Replace( + fileFilter, + "", + "_pseudo", + -1, + ) + } localFiles := searchFileFilter(".", fileFilter) for localLanguageCode, filePath := range cfgResource.Overrides {