From 23c0b882b22383b1e121731863bc542b2555c004 Mon Sep 17 00:00:00 2001 From: Dominik Brilhaus Date: Tue, 21 Nov 2023 16:26:05 +0100 Subject: [PATCH] add "arc i create" deprecation warning --- src/ArcCommander/APIs/InvestigationAPI.fs | 33 +++------------ .../CLIArguments/InvestigationArgs.fs | 40 ++++++++++--------- .../Commands/InvestigationCommand.fs | 4 +- src/ArcCommander/Program.fs | 2 +- 4 files changed, 30 insertions(+), 49 deletions(-) diff --git a/src/ArcCommander/APIs/InvestigationAPI.fs b/src/ArcCommander/APIs/InvestigationAPI.fs index bf0dd02..847e10f 100644 --- a/src/ArcCommander/APIs/InvestigationAPI.fs +++ b/src/ArcCommander/APIs/InvestigationAPI.fs @@ -22,7 +22,7 @@ module InvestigationAPI = if other.SubmissionDate.IsSome || replaceWithEmptyValues then this.SubmissionDate <- other.SubmissionDate if other.PublicReleaseDate.IsSome || replaceWithEmptyValues then this.PublicReleaseDate <- other.PublicReleaseDate - + module InvestigationFile = @@ -31,33 +31,12 @@ module InvestigationAPI = IsaModelConfiguration.getInvestigationFilePath arcConfiguration |> System.IO.File.Exists - ///// Creates an investigation file in the ARC from the given investigation metadata contained in cliArgs that contains no studies or assays. - //let create (arcConfiguration : ArcConfiguration) (investigationArgs : Map) = + /// Creates an investigation file in the ARC from the given investigation metadata contained in cliArgs that contains no studies or assays. + let create (arcConfiguration : ArcConfiguration) (investigationArgs : ArcParseResults) = - // let log = Logging.createLogger "InvestigationCreateLog" - - // log.Info("Start Investigation Create") - - // if InvestigationFile.exists arcConfiguration then - // log.Error("Investigation file does already exist.") - - // else - // let investigation = - - // let info = - // ArcInvestigation(getFieldValueByName "Identifier" investigationArgs) - // Investigation.InvestigationInfo.create - // () - // (getFieldValueByName "Title" investigationArgs) - // (getFieldValueByName "Description" investigationArgs) - // (getFieldValueByName "SubmissionDate" investigationArgs) - // (getFieldValueByName "PublicReleaseDate" investigationArgs) - // [] - // Investigation.fromParts info [] [] [] [] [] - - // let investigationFilePath = IsaModelConfiguration.tryGetInvestigationFilePath arcConfiguration |> Option.get - - // Investigation.toFile investigationFilePath investigation + let log = Logging.createLogger "InvestigationCreateLog" + + log.Error InvestigationCreateArgs.deprecationWarning /// Updates the existing investigation file in the ARC with the given investigation metadata contained in cliArgs. let update (arcConfiguration : ArcConfiguration) (investigationArgs : ArcParseResults) = diff --git a/src/ArcCommander/CLIArguments/InvestigationArgs.fs b/src/ArcCommander/CLIArguments/InvestigationArgs.fs index 24e8148..43f4e65 100644 --- a/src/ArcCommander/CLIArguments/InvestigationArgs.fs +++ b/src/ArcCommander/CLIArguments/InvestigationArgs.fs @@ -3,25 +3,27 @@ open Argu open ArcCommander.ArgumentProcessing -///// CLI arguments for creating a new investigation file for the arc -//// in the case of investigations 'empty' does not mean empty file but rather an -//// investigation without studies/assays. To reflect the need for metadata here, -//// this command is called `create` instead of `init` -//type InvestigationCreateArgs = -// | [][][][] Identifier of investigation_identifier:string -// | [] Title of title:string -// | [] Description of description:string -// | [] SubmissionDate of submission_date:string -// | [] PublicReleaseDate of public_release_date:string - -// interface IArgParserTemplate with -// member this.Usage = -// match this with -// | Identifier _-> "An identifier or an accession number provided by a repository. This SHOULD be locally unique. Hint: If you're unsure about this, you can use the name of the ARC or any name that roughly hints to what your experiment is about." -// | Title _-> "A concise name given to the investigation" -// | Description _-> "A textual description of the investigation" -// | SubmissionDate _-> "The date on which the investigation was reported to the repository" -// | PublicReleaseDate _-> "The date on which the investigation was released publicly" +/// CLI arguments for creating a new investigation file for the arc +// in the case of investigations 'empty' does not mean empty file but rather an +// investigation without studies/assays. To reflect the need for metadata here, +// this command is called `create` instead of `init` +type InvestigationCreateArgs = + | [][][][] Identifier of investigation_identifier:string + | [] Title of title:string + | [] Description of description:string + | [] SubmissionDate of submission_date:string + | [] PublicReleaseDate of public_release_date:string + + static member deprecationWarning = "DEPRECATED: isa.investigation.xlsx is now created during \"arc init\". To update isa.investigation top-level metadata, please use \"arc i update\"" + + interface IArgParserTemplate with + member this.Usage = + match this with + | Identifier _-> "An identifier or an accession number provided by a repository. This SHOULD be locally unique. Hint: If you're unsure about this, you can use the name of the ARC or any name that roughly hints to what your experiment is about." + | Title _-> "A concise name given to the investigation" + | Description _-> "A textual description of the investigation" + | SubmissionDate _-> "The date on which the investigation was reported to the repository" + | PublicReleaseDate _-> "The date on which the investigation was released publicly" /// CLI arguments updating the arc's existing investigation file type InvestigationUpdateArgs = diff --git a/src/ArcCommander/Commands/InvestigationCommand.fs b/src/ArcCommander/Commands/InvestigationCommand.fs index 98ee4f8..9ab8763 100644 --- a/src/ArcCommander/Commands/InvestigationCommand.fs +++ b/src/ArcCommander/Commands/InvestigationCommand.fs @@ -8,7 +8,7 @@ open InvestigationPublications type InvestigationCommand = - //| [] Create of create_args : ParseResults + | [] Create of create_args : ParseResults | [] Update of update_args : ParseResults | [] [] Edit //| [] Delete of delete_args : ParseResults @@ -19,7 +19,7 @@ type InvestigationCommand = interface IArgParserTemplate with member this.Usage = match this with - //| Create _ -> "Create a new investigation with the given Metadata" + | Create _ -> InvestigationCreateArgs.deprecationWarning | Update _ -> "Update the ARC's investigation with the given Metdadata" | Edit _ -> "Open an editor window to directly edit the ARC's investigation file" //| Delete _ -> "Delete the ARC's investigation file (DANGER ZONE!)" diff --git a/src/ArcCommander/Program.fs b/src/ArcCommander/Program.fs index 42db9b5..29c82e9 100644 --- a/src/ArcCommander/Program.fs +++ b/src/ArcCommander/Program.fs @@ -150,7 +150,7 @@ let handleInvestigationPublicationsSubCommands arcConfiguration publicationVerb let handleInvestigationSubCommands arcConfiguration investigationVerb = match investigationVerb with - //| InvestigationCommand.Create r -> processCommand arcConfiguration InvestigationAPI.create r + | InvestigationCommand.Create r -> processCommand arcConfiguration InvestigationAPI.create r | InvestigationCommand.Update r -> processCommand arcConfiguration InvestigationAPI.update r | InvestigationCommand.Edit -> processCommandWithoutArgs arcConfiguration InvestigationAPI.edit //| InvestigationCommand.Delete r -> processCommand arcConfiguration InvestigationAPI.delete r